Setting Variables to List Items
Setting Variables to List Items
- Subject: Setting Variables to List Items
- From: Peter Bunn <email@hidden>
- Date: Tue, 18 Mar 2003 14:09:50 -0600
Hello:
I'm trying to define (or associate?) a sequence of variables to a list of
individual items... (or at least that's what I _think_ I'm trying to do).
Please see the snippet below.
The list items in the example_string may be none or many. I'd like to
set (and pass) as many variables as there are list items... without
having to explicitly set each and every variable (as I do for variable_1
in the snippet)... and of course, without generating multiple errors if
the list items don't exist.
I can create a sequential list of variables to the count of the list
items, but I can't seem to set them to the list of items such that the
variable itself can be called by name.
Additionally, I'm thinking I might try to load and run another script to
handle all the variables, but if their number is unknown...
I'm not getting very far by just head-banging...
Any/all help is appreciated.
Thanks.
Peter B.
-----
set example_string to "-walk-run-hide-quit"
try
set _Priors_ to AppleScript's text item delimiters
set AppleScript's text item delimiters to "-"
set all_items to text items 2 through -1 of example_string as list
set AppleScript's text item delimiters to _Priors_
on error
set all_items to ""
end try
set variable_1 to item 1 of all_items
variable_1
-->"walk"
-----
tell application "Imaginary"
do variable_1
end tell
-----------------------------------------
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.