Another way would be to match a choice from one list (the descriptive list to choose from) into
set black to {"0", "0", "0"}
set blueGray to {"8000", "8000", "10000"}
set white to {"65535", "65535", "65535"}
set red to {"65535", "0", "0"}
set manual to missing value
set theChoiceList to {"black", "blueGray", "white", "red", "Choose Color"}
set theColorList to {black, blueGray, white, red, manual}
set theColor to (matchChoice from theChoiceList into theColorList)
if theColor is false then error number -128
if class of theColor is not list then set theColor to (choose color)
return theColor
to matchChoice from sourceList into objectList -- match choice from one list into another
set theChoice to (choose from list sourceList) as text
repeat with X from 1 to (count of sourceList)
if (item X of sourceList) = theChoice then return (item X of objectList)
end repeat
return false -- no match, or cancel
end matchChoice
Hi,
Looking for busy work…
In this script clip I don't see the need for the long "if then" but I'm at a loss on how to deal with "the choice" as a variable. Or maybe I need to be choosing a variable???
set blueGray to {"8000", "8000", "10000"}
set black to {"0", "0", "0"}
set white to {"65535", "65535", "65535"}
set red to {"65535", "0", "0"}
set manual to "Choose Color"
set theColorList to {"Black", "blueGray", "White", "Red", "Manual"}
tell application "GraphicConverter"
activate
set {theChoice} to choose from list theColorList default items "blueGray" with title "Color Selection"
display dialog theChoice
set theChoice to {theChoice}
set background color to theChoice
end tell
(* if theChoice = "bluegray" then
set theChoice to blueGray
else if theChoice = "Black" then
set theChoice to black
else if theChoice = "White" then
set theChoice to white
else if theChoice = "Red" then
set theChoice to red
else if theChoice = "Manual" then
set theChoice to choose color
else
set theChoice to blueGray -- default
end if *)
TIA,
Robert Poland - Fort Collins, CO