Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ElectricMan5

macrumors regular
Original poster
Jul 22, 2008
204
0
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!
 
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.
 
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:

Code:
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...
 
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
 
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 :)
 
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:

Code:
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
 
"..." 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:

Code:
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:

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
 
I fixed it :)

The correct code:

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 :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.