Passing parameters from Rev to Applescript
Kee Nethery
kee at kagi.com
Mon Dec 21 21:06:07 EST 2009
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
More information about the use-livecode
mailing list