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

simple problem?


  • Subject: simple problem?
  • From: Celine Latulipe <email@hidden>
  • Date: Mon, 19 Nov 2007 20:08:18 -0500

Hi. I'm trying to write a very simple script and I can't get it to work. It seems as though my boolean expressions are not being evaluated properly. 

The idea is that the user picks a group from a list. Based on the group they choose, the three variables mode0, mode1 and mode2 are assigned. But it's not working. No matter which group the user chooses, the default 'else' is being executed and the variables are being assigned '-1'. I don't understand what's happening. I put in display dialogs all over the place to try to figure out what's going on. The first display dialog before the if statement works and tells me which group has been selected. But then it doesn't get into any of the if statement branches, except the default 'else'. 

Here is the script:

set group to choose from list {"Group A", "Group B", "Group C", "Group D", "Group E", "Group F"} with prompt "Please select the group letter you have been assigned:"
display dialog "You selected " & group & "."
if group is "Group A" then
display dialog "You chose group A."
set mode0 to "0"
set mode1 to "1"
set mode2 to "2"
else if group is "Group B" then
display dialog "You chose group B."
set mode0 to 0
set mode1 to 2
set mode2 to 1
else if group is "Group C" then
display dialog "You chose group C."
set mode0 to 1
set mode1 to 0
set mode2 to 2
else if group is "Group D" then
display dialog "You chose group D."
set mode0 to 1
set mode1 to 2
set mode2 to 0
else if group is "Group E" then
display dialog "You chose group E."
set mode0 to 2
set mode1 to 0
set mode2 to 1
else if group is "Group F" then
display dialog "You chose group F."
set mode0 to 2
set mode1 to 1
set mode2 to 0
else
set mode0 to -1
set mode1 to -1
set mode2 to -1
end if

display dialog "Mode0 is " & mode0 & ", and Mode1 is " & mode1 & ", and Mode2 is " & mode2

Anyone have any ideas? I'm a proficient programmer, and I feel pretty dumb being stumped on an if statement. But I'm new to Applescript, so maybe it's something I'm just not aware of.

Thanks!

Celine

 _______________________________________________
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: simple problem?
      • From: Michelle Steiner <email@hidden>
    • Re: simple problem?
      • From: Paul Scott <email@hidden>
    • Re: simple problem?
      • From: Paul Scott <email@hidden>
  • Prev by Date: Re: Applescript schedulers
  • Next by Date: Re: simple problem?
  • Previous by thread: Re: Extract text from window using system events
  • Next by thread: Re: simple problem?
  • Index(es):
    • Date
    • Thread