Appearance OSAX
Appearance OSAX
- Subject: Appearance OSAX
- From: Simon Topliss <email@hidden>
- Date: Thu, 31 May 2007 17:00:37 +0100
For any Appearance OSAX users...
Today I needed a way to dynamically display a "better dialog" with an
unknown number of check boxes. This example shows how this can be
achieved. It can be easily be adapted for other field types. I'm not
too sure what the limits are for each field type.
-- BEGIN SCRIPT EXAMPLE
set colourList to {"Cyan", "Magenta", "Yellow", "Black", "Gold", "Red"}
set dialogScriptString to "set dRes to display better dialog \"Select
colours:\" fields {"
repeat with i from 1 to colourList's length
set dialogScriptString to dialogScriptString & "{kind:check box,
name:\"" & item i of colourList & "\"},"
end repeat
set dialogScriptString to (text 1 thru -2 of dialogScriptString) & "}
buttons {\"OK\", \"Cancel\"}"
set dRes to run script dialogScriptString
set coloursChosen to choices returned of dRes -- result is a list of
all checked checkboxes
-- END SCRIPT EXAMPLE
It builds a string from the list and uses "run script" to compile and
run it. Run script also returns the correct chosen "choices".
I don't think I've seen this offered as a solution before (no doubt
I'm not the first to think of it!), so I thought I'd submit it for
those who may need this functionality at some time.
Simon
ps. Appearance OSAX is a scripting addition available from http://www.
24usoftware.com/AppearanceOSAX. It's a great tool for anything other
than standard "display dialog" can offer without resorting to Xcode.
_______________________________________________
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