• 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: Why doesn't this script run?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why doesn't this script run?


  • Subject: Re: Why doesn't this script run?
  • From: Stan Cleveland <email@hidden>
  • Date: Tue, 05 Mar 2013 14:37:10 -0800

On Mar 5, 2013, at 2:20 PM, Jeffrey Madson wrote:

There are a lot of things I want to do with this script but the first is getting this part to function. Why don't I get a "you guessed it" and a couple of beeps if I select Asia?

set the region_list to {"North America", "South America", "Europe", "Asia"}

set the region to ¬

(choose from list region_list ¬

with prompt ("Choose Your Region:") ¬

default items {"Wayne"}) as string

if the region is false then error number -128

return region

if (text returned of "Asia") is "Asia" then

beep

display dialog "you guessed it"

beep

end if

Hi Jeffrey,

The line "return region" ends script execution. For the script to go on, you need to delete that line. But, after that, there are some additional problems and superfluous stuff in the program. The code below has those issues fixed and should do what you want.

I see that Santa has also responded, but you'll see some differences between his code and mine. Comparing the two versions might give you some additional insights into AppleScript.

Regards,
Stan C.

set region_list to {"North America", "South America", "Europe", "Asia"}
set region to (choose from list region_list ¬
with prompt "Choose Your Region:") as string
if region is false then
error number -128
else if region is "Asia" then
beep
display dialog "you guessed it"
beep
end if

 _______________________________________________
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: 
 >Why doesn't this script run? (From: Jeffrey Madson <email@hidden>)

  • Prev by Date: Re: Why doesn't this script run?
  • Next by Date: Re: Why doesn't this script run?
  • Previous by thread: Re: Why doesn't this script run?
  • Next by thread: Re: Why doesn't this script run?
  • Index(es):
    • Date
    • Thread