Passing parameters from Rev to Applescript

Terry Judd tsj at unimelb.edu.au
Mon Dec 21 22:16:58 EST 2009


The merge function is really useful here.

put "Pictures" into tWindowName
do merge(fld 1) as applescript

Where fld 1 contains...

tell application "Finder" to get bounds of window "[[tWindowName]]"

Terry...



On 22/12/09 1:06 PM, "Kee Nethery" <kee at kagi.com> wrote:

> 
> On Dec 21, 2009, at 3:01 PM, Howard Bornstein wrote:
> 
>> Hmmm, I thought this was straightforward but I can't seem to get this to
>> work.
>> 
>> I want to pass a value from Rev to an applescript. Here is a simplified
>> version of what I'm trying to do:
>> 
>> on mouseup
>>     Put "Pictures" into tWindowName
>>     do field 1 as Applescript
>> end mouseup
>> 
>> Field 1 contains the following:
>> 
>> Set theWindow to tWindowName
>> Tell application "Finder"
>>     get bounds of window theWindow
>> end tell
>> 
>> This results in an applescript execution error. If I substitute "Pictures"
>> for tWindowName, it works properly. But rather than hard-coding the window
>> name into the applescript I want to pass it as a parameter.
> 
> tWindowName is not a variable. When it is in a field, it is just text. Nothing
> special about it. If you want this to work, what you could do is replace the
> text of tWindowName with the data you want it to contain. For example:
> 
> on mouseup
>     Put "Pictures" into tWindowName
>     put field 1 into whatToSend
>     replace "tWindowName" with quote & tWindowName & quote in whatToSend
>     -- doing this replaces the text with the data in the variable
>     do whatToSend as Applescript
> end mouseup
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list