• 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: detect return, expanded
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detect return, expanded


  • Subject: Re: detect return, expanded
  • From: Robert Poland <email@hidden>
  • Date: Sat, 05 Nov 2011 10:28:56 -0600

On Nov 5, 2011, at 10:20 AM, wayne melrose wrote:

On Nov 5, 2011, at 5:13 PM, KOENIG Yvan wrote:

but in fact I don't understand your problem.

Given the bare script :

set theColorList to {"0-none", "1-orange", "2-red", "3-yellow", "4-blue", "5-purple", "6-green", "7-gray"}
set theDefaultChoice to "0-none"
-- point #1
set theChoice to choose from list theColorList default items theDefaultChoice with title "Color"
-- point #2

If you press escape, you will exit silently
If you wait too much, you will get an error message claiming that the waited event took too much time to apply.
You will reach the point #2 only if you press return.


I'm also having trouble understanding what your goal is and why you'd need a loop? 

Also, I don't understand why you would present the user with the indexes for each colour? (looks ugly) Why not just display the colour, then, if you need the index for something later in your script, you could derive it from the result 


set theColorList to {"none", "orange", "red", "yellow", "blue", "purple", "green", "gray"}
set theDefaultChoice to "none"

set {theChoice} to choose from list theColorList default items theDefaultChoice with title "Color" as string

set x to 0
repeat with strColour in theColorList
log strColour as string
if theChoice is (strColour as string) then
set intIndex to x
exit repeat
end if
set x to x + 1
end repeat

return {intIndex, theChoice}
_____________________

With the numbers I can select any color by picking a number. Without I can pick any color, EXCEPT gray by choosing the first letter, I must type the first three letters to get gray.


Robert Poland - Fort Collins, CO



 _______________________________________________
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: 
 >detect return, expanded (From: Robert Poland <email@hidden>)
 >Fwd: detect return, expanded (From: KOENIG Yvan <email@hidden>)
 >Re: detect return, expanded (From: wayne melrose <email@hidden>)

  • Prev by Date: Re: detect return, expanded
  • Next by Date: Fwd: detect return, expanded
  • Previous by thread: Re: detect return, expanded
  • Next by thread: Re: detect return, expanded
  • Index(es):
    • Date
    • Thread