External Functions?

is there a way to… run a function that isnt in your script?


Assuming you have a compiled script that contains a function called ‘DoSomething()’, you can:

set loadedScript to load script (<path to script>)

set myVar to loadedScript's doSomething()

myVar will now hold the result of the doSomething function in the external script.

cool thanks dude

You can even make call to a handler of a script saved as an applet.
eg :

your applet is saved as myapp for example, and its code is :

on dispdlg(thistext)
display dialog thistext

your script : tell app “myapp” to dispdlg(“It’s working”)

then where could the external .app be?

wherever you want but you’ll have to locate the app the first time you compile the script or whenever you change the location of your application.