Re: AppleScript-Users Digest, Vol 9, Issue 226
Re: AppleScript-Users Digest, Vol 9, Issue 226
- Subject: Re: AppleScript-Users Digest, Vol 9, Issue 226
- From: "email@hidden" <email@hidden>
- Date: Sun, 27 May 2012 01:51:08 +0800
发自我的 iPhone
在 May 27, 2012,1:31 AM,email@hidden 写道:
> Send AppleScript-Users mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.apple.com/mailman/listinfo/applescript-users
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of AppleScript-Users digest..."
>
>
> Today's Topics:
>
> 1. Still trying to learn list subtleties (Robert Poland)
> 2. Re: Still trying to learn list subtleties (KOENIG Yvan)
> 3. Re: Still trying to learn list subtleties (Robert Poland)
> 4. Re: Still trying to learn list subtleties (Luther Fuller)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 26 May 2012 11:01:50 -0600
> From: Robert Poland <email@hidden>
> To: AppleScript Users <email@hidden>
> Subject: Still trying to learn list subtleties
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
> 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
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120526/f6004044/attachment.html>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 26 May 2012 19:22:33 +0200
> From: KOENIG Yvan <email@hidden>
> To: liste AppleScript US <email@hidden>
> Subject: Re: Still trying to learn list subtleties
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
>
> Le 26 mai 2012 à 19:01, Robert Poland a écrit :
>
>> 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
>>
>
> I edited the script so that it's easier to explain.
>
> 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"}
>
> set theChoice to choose from list theColorList default items "blueGray" with title "Color Selection"
> (* the result is a list or the boolean « false » *)
> if theChoice is false then error number -128 (* Exit silently *)
> set theChoice to item 1 of theChoice
> (* Here, theChoice is a string *)
> display dialog theChoice
>
> (* This if-then-else block will define the color value *)
> if theChoice = "Manual" then
> choose color
> (* Here the result is a RGB color *)
> set theColor to result
> else if theChoice = "bluegray" then
> set theColor to blueGray
> else if theChoice = "Black" then
> set theColor to black
> else if theChoice = "White" then
> set theColor to white
> else if theChoice = "Red" then
> set theColor to red
> else
> set theColor to blueGray -- default
> end if
> tell application "GraphicConverter"
> activate
> set background color to theColor
> end tell
>
> Yvan KOENIG (VALLAURIS, France) samedi 26 mai 2012 19:22:29
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120526/f4cf95f9/attachment.html>
>
> ------------------------------
>
> Message: 3
> Date: Sat, 26 May 2012 11:31:06 -0600
> From: Robert Poland <email@hidden>
> To: KOENIG Yvan <email@hidden>
> Cc: liste AppleScript US <email@hidden>
> Subject: Re: Still trying to learn list subtleties
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
>
> On May 26, 2012, at 11:22 AM, KOENIG Yvan wrote:
>
>>
>> Le 26 mai 2012 à 19:01, Robert Poland a écrit :
>>
>>> 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
>>>
>>
>> I edited the script so that it's easier to explain.
>>
>> 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"}
>>
>> set theChoice to choose from list theColorList default items "blueGray" with title "Color Selection"
>> (* the result is a list or the boolean « false » *)
>> if theChoice is false then error number -128 (* Exit silently *)
>> set theChoice to item 1 of theChoice
>> (* Here, theChoice is a string *)
>> display dialog theChoice
>>
>> (* This if-then-else block will define the color value *)
>> if theChoice = "Manual" then
>> choose color
>> (* Here the result is a RGB color *)
>> set theColor to result
>> else if theChoice = "bluegray" then
>> set theColor to blueGray
>> else if theChoice = "Black" then
>> set theColor to black
>> else if theChoice = "White" then
>> set theColor to white
>> else if theChoice = "Red" then
>> set theColor to red
>> else
>> set theColor to blueGray -- default
>> end if
>> tell application "GraphicConverter"
>> activate
>> set background color to theColor
>> end tell
>>
>> Yvan KOENIG (VALLAURIS, France) samedi 26 mai 2012 19:22:29
>
> So you're saying that there is no way to go directly from "theChoice" as a choice to "theChoice" as a variable?
>
>
> Robert Poland - Fort Collins, CO
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120526/cac98685/attachment.html>
>
> ------------------------------
>
> Message: 4
> Date: Sat, 26 May 2012 12:31:28 -0500
> From: Luther Fuller <email@hidden>
> To: Applescript Users <email@hidden>
> Subject: Re: Still trying to learn list subtleties
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> On May 26, 2012, at 12:01 PM, Robert Poland wrote:
>
>> 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
>
> choose from list is playing a dirty trick. Use this ...
>
> set theChoice to choose from list theColorList default items "blueGray" with title "Color Selection"
> if class of theChoice is boolean then return -- the user cancelled
> set theChoice to (item 1 of theChoice) -- class of theChoice is now 'text'
> display dialog theChoice
>
> Now use the long 'if ... else ... end if'.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120526/d35981d2/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> AppleScript-Users mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/applescript-users
>
> End of AppleScript-Users Digest, Vol 9, Issue 226
> *************************************************
_______________________________________________
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