Applescript variable contents

Terry Vogelaar terry at
Tue Mar 12 14:11:01 EST 2002

> I want to run a series of Applescripts from within a Rev standalone
> and have the variable values carry across from one Applescript to
> another. Is there a way to capture Applescript variable values into
> Revolution and then back to Applescript? (other than using a text
> file as an intermediary!)

Maybe you can use this (sorry for the reposting of this ):

The basic idea is that you store the AS-functions in a separate file; a
normal AppleScript-file. No custom props or fields needed, so you don't have
to work with a copy of the script, but you can work with the original, which
saves time when the AppleScript function is still in development.

Then you must know the path and the name of the function in the file. You
call it with:

get AppleScriptFunction("nameOfFunction", "path:to:file", 1, 2, "three",

Mind that on Mac OS classic you need to use colons in the path (2nd param),
while on Mac OS X you must use slashes.

Then in the stack-script you can put:

function AppleScriptFunction aFun, aFile
  put "set theScript to load script (alias "&quote&aFile&quote&")"&return& \
      "tell theScript to "&aFun&"(" into ASfunc
  if paramcount() > 2 then
    repeat with e = 3 to paramcount()
      put param(e) into f
      if param(e) is a number then
        put f & "," after ASfunc
        put quote & f & quote & "," after ASfunc
      end if
    end repeat
    put " " after ASfunc
  end if
  put ")" into last char of ASfunc
  do ASfunc as applescript
end AppleScriptFunction

Now you can call any function with any number of parameters. The value that
is returned by the AppleScript-function is returned by "AppleScriptFunction"
as well.

> The overall goal here is to use Revolution to provide a window and a
> progress bar to a running Applescript.  I'm also trying to figure out
> how to launch an app (the Apple System Profiler) in a hidden way so
> the user doesn't have to see it.

AppleScript only returns something to RunRev when a function is completely
finished. So you can let the progress bar shift when a function is
completed, but probably not when only one long AppleScript function is

I don't know if you can hide an app (probably you can, but I don't know
how). But as long as you don't use 'activate', it stays in the background.


More information about the use-livecode mailing list