Re: dynamic variables
Re: dynamic variables
- Subject: Re: dynamic variables
- From: julifos <email@hidden>
- Date: Thu, 24 Jul 2003 09:39:54 +0200
>
is there any way to create variables dynamically in applescript?
>
>
thanks,
>
-j
Do you mean using a string created on-the-fly?
You can, but it is not a recomendable practice, unless you need it so bad...
In this sample, you can see that I assign an integer value to the new var;
there are not problems, since I can coerce an integer to string, and build
the entire "script" string to "run". But for a list or record, I should
write some extra lines to "stringize" such list or record...
Here, the sample:
#########################################
--> get hard disk name, eg, to build a variable
set varName to text 1 thru -2 of ("/" as POSIX file as string)
set varValue to varName's length --> create also a value on-the-fly
--> enclose varName within "|", to avoid blank spaces and special chars
set myVar to run script "set my parent's |" & varName & "| to " & varValue
whatever * 2 --> test it! My disk is called "whatever", so this returns 16
#########################################
jj
_______________________________________________
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.