Wednesday, December 13, 2017

#1 2009-11-10 03:05:46 pm

FlameCoder
Member
From:: USA
Registered: 2009-10-28
Posts: 82

Load Script File

I want to load a external script file like I did in AS Studio.

As an example I have this bit in the applicationWillFinishLaunching_(aNotification) handler...

----------------------
set LoadedScript to (load script file ((path to desktop as string) & "MyScript.scpt"))
tell LoadedScript to RunScript()
----------------------

And this in the external script on my desktop

----------------------
--External script named MyScript.scpt
on RunScript()
    display dialog "Here"
end RunScript
----------------------

This code will work as expected in AppleScript Editor but give this error in ASOC...

2009-11-10 15:02:48.724 Retriever[7381:a0f] *** -[RetrieverAppDelegate applicationWillFinishLaunching:]: Can’t make current application into type file. (error -1700)

Offline

 

#2 2009-11-10 03:59:24 pm

FlameCoder
Member
From:: USA
Registered: 2009-10-28
Posts: 82

Re: Load Script File

I figured it out and it seems to work by changing the code to this...

set LoadedScript to (load script (((path to desktop as string) & "MyScript.scpt")) as alias)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)