• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Variable not defined
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable not defined


  • Subject: Re: Variable not defined
  • From: "koenig.yvan" <email@hidden>
  • Date: Wed, 01 Jan 2014 00:15:21 +0100


Le 31/12/2013 à 22:43, Porter Slice <email@hidden> a écrit :

Thank you all for your help earlier regarding executing scripts via ip address, I could not have done it without your help and am now pointed in the right direction. However, I am having trouble with the script below, every time I try to run it, I get the following error: 

error "The variable speakHour is not defined." number -2753 from "speakHour"

I got this code about a year ago, it was written by someone else, and I am unfamiliar with it. Any help would be greatly appreciated. 

Thank you, 

Porter Slice 


set theBoolean to "True"
say "What Time Would You Like To Wake Up?" using "Alex"
set theTime to the text returned of (display dialog "What Time Would You Like To Wake Up?" default answer "6 30")

if the length of theTime is 1 then
set theHour to "0" & theTime as string
set theMinutes to "00" as string
else if the length of theTime is 2 then
set theHour to theTime as string
set theMinutes to "00" as string
else if the length of theTime is 3 then
set theHour to "0" & character 1 of theTime as string
set theMinutes to characters 2 thru 3 of theTime as string
else if the length of theTime is 4 then
set theHour to characters 1 thru 2 of theTime as string
set theMinutes to characters 3 thru 4 of theTime as string
else
say "That is an un known time" using "Alex"
say "You're alarm has not been set" using "Alex"
return
end if

The problem is in this piece of code.

If you typer 6 30
the variable theHour will be "6 " which is not treated in the piece of code building speakHour
It would be useful to normalize theHour with :

set theHour to text -2 thru -1 of (100 + (theHour as integer) as text)

Yvan KOENIG (VALLAURIS, France) mercredi 1 janvier 2014 00:15:15



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Variable not defined (From: Porter Slice <email@hidden>)

  • Prev by Date: Variable not defined
  • Previous by thread: Variable not defined
  • Index(es):
    • Date
    • Thread