Re: Setting Variables to List Items
Re: Setting Variables to List Items
- Subject: Re: Setting Variables to List Items
- From: John Delacour <email@hidden>
- Date: Wed, 19 Mar 2003 12:01:06 +0000
- Mac-eudora-version: 6.0a11
At 8:51 am +0100 19/3/03, Emmanuel wrote:
Now your snippet lets me think that you want to use the contents of
the variable *as a script*. My advice above remains true, you would
say:
set example_string to "walk()-run()-hide()-quit"
set AppleScript's text item delimiters to "-"
set all_items to text items 2 through -1 of example_string as list
set theAction to item 1 of all_items
----------------------
tell application "Imaginary"
do script theAction
end
----------------------
Actually I think the script above won't work, I would rather try:
----------------------
set theScript to "tell application \"Imaginary\"
" & theAction & "
end"
do script theScript
----------------------
Why not pass all the parameters to the applet and let it handle them:
set s to "walk-run-hide-quit"
set my text item delimiters to "-"
set _list to text items of s
set my text item delimiters to ""
set n to 3
tell |application "Imaginary"| to manage(_list, n)
script |application "Imaginary"|
on manage(_list, n)
beep
if n is greater than the number in the _list then return
if n is 0 then
return _list
else
return "Can't " & item n of _list
end if
end manage
end script
_______________________________________________
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.