PDA

View Full Version : Applescript error -1708?




ElectricMan5
May 24, 2009, 02:38 PM
I just finished building an Applescript application in Xcode, and whenever I click a button linked to a script i get an error:

Applescript Error

-1708


I don't know what I'm doing wrong, and I can't find anyone else who's had this error. Thanks!



ElectricMan5
May 24, 2009, 07:18 PM
I guess i'm the only one who has it...

lee1210
May 24, 2009, 07:51 PM
Can you post the code? Surprisingly the apple site was not too forthcoming about this error, but the code that corresponds is errAEEventNotHandled, and a few other people described this occurring when a tell was sent to an app that was not scriptable, so that may be the case here.

-Lee

Edit: Some other posts suggest that if you have handlers set up in interface builder that do not have corresponding applescript code you might get this.

ElectricMan5
May 24, 2009, 09:13 PM
Can you post the code? Surprisingly the apple site was not too forthcoming about this error, but the code that corresponds is errAEEventNotHandled, and a few other people described this occurring when a tell was sent to an app that was not scriptable, so that may be the case here.

-Lee

Edit: Some other posts suggest that if you have handlers set up in interface builder that do not have corresponding applescript code you might get this.

Well, I did an extremely simple thing. I just assigned a button to an applescript which runs when clicked. This is the applescript:

tell application "Finder"
activate
open application file "World of Warcraft.app" of folder "World of Warcraft" of item ".Games" of item ".websitebackup" of folder "Desktop" of folder "Will" of folder "Users" of startup disk
end tell


It works perfectly when I run it, but it gives me the error in the full application. I think Xcode might be doing something wrong to it...

mysterytramp
May 24, 2009, 09:41 PM
Well, I did an extremely simple thing. I just assigned a button to an applescript which runs when clicked.

1) put the "open application file" inside a "try ... on error ... end try" block. Trap the error and see what changes.

2) don't scripts inside Xcode buttons need to be inside "on run ... end run" blocks?

mt

ElectricMan5
May 24, 2009, 10:07 PM
1) put the "open application file" inside a "try ... on error ... end try" block. Trap the error and see what changes.

2) don't scripts inside Xcode buttons need to be inside "on run ... end run" blocks?

mt

I really don't know what you mean by that... Could you change my code to what your talking about?

I don't know what you mean by the "..."

Thanks :-)

mysterytramp
May 24, 2009, 10:15 PM
I really don't know what you mean by that... Could you change my code to what your talking about?

I don't know what you mean by the "..."

Thanks :-)

"..." means you fill in the blanks.

try
open application file "TextEdit"
on error
display dialog "Didn't work"
end try

OK?

My previous post was wrong. It's not "on run," it's "on clicked." The script of your button should be:

on clicked theObject
try
open application file "TextEdit" -- I'll leave you to enter that lengthy path
on error
display dialog "Didn't work"
end try
end clicked

I'm betting you got an errAEEventNotHandled error message because the button doesn't handle tell messages. It handles clicked messages. And you'll have to make sure in Xcode that the button is ready to accept clicked messages.

mt

ElectricMan5
May 24, 2009, 10:28 PM
"..." means you fill in the blanks.

try
open application file "TextEdit"
on error
display dialog "Didn't work"
end try

OK?

My previous post was wrong. It's not "on run," it's "on clicked." The script of your button should be:

on clicked theObject
try
open application file "TextEdit" -- I'll leave you to enter that lengthy path
on error
display dialog "Didn't work"
end try
end clicked

I'm betting you got an errAEEventNotHandled error message because the button doesn't handle tell messages. It handles clicked messages. And you'll have to make sure in Xcode that the button is ready to accept clicked messages.

mt

I fixed it :-)

The correct code:

on clicked theObject
tell application "Finder"
activate
open application file "World of Warcraft.app" of folder "World of Warcraft" of item ".Games" of item ".websitebackup" of folder "Desktop" of folder "Will" of folder "Users" of startup disk
end tell
end clicked

ElectricMan5
May 24, 2009, 10:29 PM
I fixed it :-)

The correct code:

on clicked theObject
tell application "Finder"
activate
open application file "World of Warcraft.app" of folder "World of Warcraft" of item ".Games" of item ".websitebackup" of folder "Desktop" of folder "Will" of folder "Users" of startup disk
end tell
end clicked


Lol i fixed it before I saw your reply :-) now that i look at it, you gave the same code also. I guess I found it myself :-)