• 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
how?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how?


  • Subject: how?
  • From: Jack Schwart <email@hidden>
  • Date: Sun, 10 Jan 2010 15:55:09 -0500

Hi, I am trying to teach myself applescript.  I went through Jerry Lee Ford, Jr.'s book, Applescript for the Absolute Beginner, and understood everything except this following code block.  Can any one help me figure out how the variable "ValidInput" switches to "true" and ends the loop?

Thanks, Jack

--******** GetPlayerInput handler ******************

--This handler prompts the player to tell the game the range of 
--numbers from which lottery ticket numbers should be selected
on GetPlayerInput()


--This variable is used to control loop execution
set ValidInput to false


repeat until ValidInput = true -- loop until valid input is collected


--Question,:how does ValidInput switch to true???


--Prompt the player to specify the range of numbers to be used
set NoRange to text returned of (display dialog ¬
"What is the highest number that can be selected when " & ¬
"creating a lottery ticket?" default answer ¬
"44" buttons {"OK"} with title GameTitle)
--The range must be at least 3 and no larger than 59
if (NoRange > 2) and (NoRange < 60) then
set NoRange to NoRange as integer --Convert the player input
--Question:  Why do I need this step???? A: see page 101 "Coercion"
return NoRange -- Return the player's input
else -- Display an error message if the input is not valid
display dialog "Error:  You must enter an integer value " & ¬
"between 3 and 59" with title GameTitle
end if


end repeat


end GetPlayerInput

=
 _______________________________________________
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

  • Follow-Ups:
    • Re: how?
      • From: Chris Page <email@hidden>
    • Re: how?
      • From: "email@hidden" <email@hidden>
    • Re: how?
      • From: Shane Stanley <email@hidden>
    • Re: how?
      • From: Barry Wainwright <email@hidden>
    • Re: how?
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: Snow Leopard osax security and 'run script' with parameters
  • Next by Date: RE: Snow Leopard osax security and 'run script' with parameters
  • Previous by thread: Re: Snow Leopard osax security and 'run script' with parameters
  • Next by thread: Re: how?
  • Index(es):
    • Date
    • Thread