• 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: Still trying to learn list subtleties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Still trying to learn list subtleties


  • Subject: Re: Still trying to learn list subtleties
  • From: Shane Stanley <email@hidden>
  • Date: Sun, 27 May 2012 13:14:55 +1000

I don't have a recent version of Graphic Converter, but I'm sure you don't need to quote all those numbers.

If you're happy to get a bit of outside help, I'd put the colors in a record:

set theColorList to {blueGray:{8000, 8000, 10000}, black:{0, 0, 0}, white:{65535, 65535, 65535}, red:{65535, 0, 0}, manual:{}}
tell application "ASObjC Runner" to set theColorNames to all labels of theColorList
set theChoice to choose from list theColorNames default items "blueGray" with title "Color Selection"
if theChoice is false then error number -128
set theChoice to item 1 of theChoice
if theChoice = "manual" then
set theColor to (choose color)
else
tell application "ASObjC Runner" to set theColor to item 1 of (value for label theChoice in records {theColorList})
end if

But with due respect, I think your choice of colors is a bit, well, limited. So you might like to try something like this:

script x
set theColors to current application's NSColorList's colorListNamed_("Crayons")
set theColorNames to theColors's allKeys()
activate
set theChoice to choose from list ((theColorNames as list) & {"Manual"})
if theChoice is false then return {65535, 65535, 65535}
if item 1 of theChoice = "Manual" then return false
set chosenColor to theColors's colorWithKey_(item 1 of theChoice)
return {(chosenColor's redComponent() as integer) * 65535, (chosenColor's greenComponent() as integer) * 65535, (chosenColor's blueComponent() as integer) * 65535}
end script

tell application id "au.com.myriad-com.ASObjC-Runner" -- ASObjC Runner.app
set theResult to run the script {x} with response
end tell
if theResult = false then
activate
set theResult to choose color
end if

-- 
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>


 _______________________________________________
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: Still trying to learn list subtleties
      • From: Christopher Stone <email@hidden>
References: 
 >Still trying to learn list subtleties (From: Robert Poland <email@hidden>)
 >Re: Still trying to learn list subtleties (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Still trying to learn list subtleties
  • Next by Date: Re: Still trying to learn list subtleties
  • Previous by thread: Re: Still trying to learn list subtleties
  • Next by thread: Re: Still trying to learn list subtleties
  • Index(es):
    • Date
    • Thread