How to run a script file from within a script?

Hey,

I’m pretty sure this is VERY basic, but I can’t seem to find anything on it. What’s the applescript command for running a script from file? Compiling to application is painfully slow and doesn’t seem to work very well (it opens, but doesn’t quit. Or it generates and error).

Thanks,

Øyvind

To run a script from another script:


set pathToScript to "Path:To:Script.scpt"
run script file pathToScript

To load the script and call it’s handlers:


set pathToLibraryOne to "System:scriptLibrary:libraryOne.scpt"
set libOne to load script file pathToLibraryOne

--call one of it's handlers
libOne's doSomething(param)

hth,

Craig

You can also set variables in the loaded script if necessary.

set pathToLibraryOne to "System:scriptLibrary:libraryOne.scpt"
set libOne to load script file pathToLibraryOne

--call one of it's handlers
tell libOne
set it's variableInLoadedScript to "New Value"
doSomething(param)
end tell

Thanks guys!

Cheers!