Re: Load Script Problem
Re: Load Script Problem
- Subject: Re: Load Script Problem
- From: Dave <email@hidden>
- Date: Fri, 13 Nov 2015 17:30:37 +0000
Thanks Shane,
I posted this to a different thread but I wondered if you could spot the problem:
I’m trying to save a .applescript file into complied .scpt file and then load it. Please see the following Handler:
on CompileAndSaveFile(theScriptFileBaseFolderPath, theScriptFileName)
my LogFileWrite(gLogFileRef, "CompileAndSaveFile() Enter" & return)
my LogFileWrite(gLogFileRef, "theScriptFileBaseFolderPath: " & theScriptFileBaseFolderPath & return)
my LogFileWrite(gLogFileRef, "theScriptFileName: " & theScriptFileName & return)
set mySourceFileName to theScriptFileName & ".applescript"
set myDestFileName to theScriptFileName & ".scpt"
tell application "Finder"
set myScriptFilePathName to theScriptFileBaseFolderPath & mySourceFileName
set myCompiledScriptPathPath to theScriptFileBaseFolderPath & myDestFileName
my LogFileWrite(gLogFileRef, "Creating Script File" & return)
my LogFileWrite(gLogFileRef, "myScriptFilePathName: " & myScriptFilePathName & return)
my LogFileWrite(gLogFileRef, "myCompiledScriptPathPath: " & myCompiledScriptPathPath & return)
store script file myScriptFilePathName in file myCompiledScriptPathPath replacing yes
end tell
my LogFileWrite(gLogFileRef, "CompileAndRunScriptFile Return")
return myCompiledScriptPathPath
end CompileAndSaveFile
I run this and the paths are as follows:
myScriptFilePathName: JaundicedOutlook:Documents:Development:Projects:TestAS:AppleScriptHandlers:LTWAppleScriptHandlerOutlook.applescript
myCompiledScriptPathPath: JaundicedOutlook:Documents:Development:Projects:TestAS:AppleScriptHandlers:LTWAppleScriptHandlerOutlook.scpt
The .applescript file exists and compiles in the Script Editor, but when I run my script, I get this error:
Run Error Number: -1700
Message: Finder got an error: "Can’t make file JaundicedOutlook:Documents:Development:Projects:TestAS:AppleScriptHandlers:LTWAppleScriptHandlerOutlook.applescript" into type script.
on the:
store script file myScriptFilePathName in file myCompiledScriptPathPath replacing yes
Statement.
Any idea how to make this work?
Thanks a lot
All the Best
Dave
> On 13 Nov 2015, at 02:02, Shane Stanley <email@hidden> wrote:
>
> On 13 Nov 2015, at 1:00 PM, Shane Stanley <email@hidden> wrote:
>>
>> Because it's within an Xcode project, there are some extra complications. The load script command will need to be targeted at the current application (tell current application to set myTargetOutlookScript to ...).
>
> I take that back -- it's the normal read and write commands that require that. Nonetheless, I believe store script doesn't work regardless.
>
> --
> Shane Stanley <email@hidden>
> <www.macosxautomation.com/applescript/apps/>
>
>
> _______________________________________________
> 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
_______________________________________________
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