Re: Store Script Problem
Re: Store Script Problem
- Subject: Re: Store Script Problem
- From: Shane Stanley <email@hidden>
- Date: Sun, 15 Nov 2015 17:02:04 +1100
On 15 Nov 2015, at 4:01 PM, Christopher Stone <email@hidden> wrote:
If you look at store script it requires a script object as its direct object.
A text script is NOT a script object.
Ah, I didn't even notice that -- good point.
But it's not going to make much difference, I don't think, because store script and ASObjC don't get along. Try adding use framework "Foundation" to the script you posted elsewhere, to see what I mean.
I suspect there is a method using ASObjC (but that'll have to wait for Shane).
In this case Dave is writing a hybrid Objective-C/AS app, so he might as well just do it in Objective-C or C. But it can be done like this:
use framework "Foundation" use framework "OSAKit"
set sourceURL to current application's class "NSURL"'s fileURLWithPath:"path/to/file.applescript" set destURL to current application's class "NSURL"'s fileURLWithPath:"path/to/file.scpt" set theScript to current application's OSAScript's alloc()'s initWithContentsOfURL:sourceURL set theResult to theScript's compileAndReturnError:(missing value) if theResult as boolean then theScript's writeToURL:destURL ofType:(current application's OSAStorageScriptType) |error|:(missing value) end if
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden