Preload compiled AppleScript?
Preload compiled AppleScript?
- Subject: Preload compiled AppleScript?
- From: Nate Alf <email@hidden>
- Date: Mon, 31 Mar 2003 16:30:26 -0600
I can execute a compiled AppleScript:
NSString *kCompiledScript = [[NSBundle mainBundle] pathForResource:@"testScript" ofType:@"scpt" ];
NSMutableString *kScriptText = [[NSMutableString alloc] initWithString:@"kTest(1, \"helloWorld\") of (load script (POSIX file \""];
[kScriptText appendString: kCompiledScript];
[kScriptText appendString: @"\"))"];
NSAppleScript *kAppleScript = [[NSAppleScript alloc] initWithSource:kScriptText];
NSString *kResult=[[NSString alloc] initWithString:[[kAppleScript executeAndReturnError:nil] stringValue]];
- But I am looking for a way to preload the compiled script (not just the NSString path), and
save, rather than having to reload it each time the script is called.
Something akin to the following vanilla AppleScript:
property kScriptLibrary : {}
on run
set kScriptLibPath to "/Path/To/Compiled/Script.scpt"
set kScriptLibrary to (load script (POSIX file kScriptLibPath)) --load and store for later use
kTest(1, "helloWorld") of kScriptLibrary
end run
Has anyone here any suggestions to make this same functionality work in Obj-C, or is this just a bad idea?
Nate
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.