Applescript variable contents

Terry Vogelaar terry at
Tue Mar 12 22:50:01 EST 2002

> Hm... I don't get it. There's no line ApplescriptFunction which
> contains a return command. Isn't that necessary to obtain a return
> value from a function?

When I made this function, I planned to write the part that returns a value
when the rest was finished. But when I started to test it, it already
returned the proper values! In other words: I don't get it too! :-) But it
works just fine. Try it.


>> get AppleScriptFunction("nameOfFunction", "path:to:file", 1, 2, "three",
>> "four")
>> 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
>> else
>> put quote & f & quote & "," after ASfunc
>> end if
>> end repeat
>> else
>> 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.

More information about the use-livecode mailing list