Script runs in Script Editor, but not when double clicked

Anyone know why a script saved as an application doesn’t do anything when double clicked, but will run ok if I open it in Script Editor and hit the run button?

Earlier versions of the script worked fine, but after doing some editing, it no longer works. Are there any obvious things that would help me find what I did to break it?

thanks,
Andy

Some things to check:

Does the script have an explicit run handler (on run()) or is it implicit (no specific run handler)?

Is the script already open/running when you double-click it?
There’s a separate handler called reopen that gets called when the app is double-clicked again, e.g:

on run
–program code here
end run

on reopen
display dialog (“I’m already open”}
end reopen

the reopen handler only makes sense for ‘stay open’ scripts, so it may not be relevant in your case.

How far have you tried to debug this?
For example, have you splattered ‘beep’ and ‘display dialog’ statements around the code to see if you can break it down to a specific block?

The script does not have an explicit run handler.

The script is not open when I attempt to run it.

I tried beeps scattered throughout, but none of them beep.

So, without an explicit run handler, your first line is a “beep” and it won’t beep (and your volume is on :lol: ).
Have you tried: 1. copy code; 2. delete applet/droplet from your HD; 3. recompile & save
Or: compile from other script editor (eg, Smile)

Yep, volume is up and everything. The applescript icon does half a bounce in the dock and is gone. But it runs fine if I hit the run button in the Script Editor.

Okay, I tried the cut and paste into a new doc and now it works fine. I guess the original file was corrupt somehow. Very strange. Thanks for the good debugging tips.

Perhaps you opened a copy of an OS 9 applet, then “overwrote” it as a X applet. This sometimes may corrupt the app… ( :?: )