Load Script

Hello,

I am having a very hard time with this and cannot figure out why. I am trying to load a script within an AS Studio app. I keep getting the AppleScript Error
“File PATH:TO:Sync Machine:build:Debug:SyncMachine.app:Contents:Resources:Scripts:copyFiles.applescript wasn’t found. (-43)”.

I added a new AppleScript Text file in Xcode, which dropped the file in the Scripts folder. I add some code to it and now I want to call it but can’t seem to.

set copyScript to ((path to me as text) & "Contents:Resources:Scripts:copyFiles.applescript") as string
	load script alias copyScript

Any help would be great,
Thanks
Dallas

Model: MacBook
AppleScript: XCODE 2.4.1
Browser: Safari 525.18
Operating System: Mac OS X (10.4)

Thanks Jacques. I will give it a try.
Dallas

As soon as I used .scpt file everything worked fine. Thanks for your help.

On another note, I read post that indicated that you could call a handler in the loaded script but I keep getting a message that the script doesn’t under stand the message.

Ex.


set copyScript to ((path to me as string) & "Contents:Resources:Scripts:copyFiles.scpt") as alias
load script copyScript
copyScript's copyFiles(startwatch) --The handler is named this in the copyFiles script but it errors out.

Any suggestions would be great.
Thanks
Dallas

Hi Dallas,

you try to use the handler of the alias, not of the loaded script :wink:


set copyScriptpath to ((path to me as string) & "Contents:Resources:Scripts:copyFiles.scpt") as alias
set copyScript to load script copyScriptpath
copyScript's copyFiles(startwatch) --The handler is named this in the copyFiles script but it errors out.

That makes perfect sense now, and works great as well. Thanks Stefan,
Dallas