is a script run from the scripts menu still running?

scripts are not listed by system events as processes. so how can you tell if one is still running if it has been run from the scripts menu?

in my case I have a long script that is supposed to give progress updates via growl and a sticky notification when it is finished also via growl. I get some of the progress notifications but not all, and the final “complete” one never happens. Still, as far as I can tell it has done it’s job otherswise, so possibly it’s just a problem with the notifications. While I could, I realize, use another notification method to test this, it makes me curious, could I tell if the script is still “tickin’” ? I don’t think it shows up in top or activity monitor either.

Thanks

It sounds like the script may be timing out or stumbling over an error it isn’t reporting. Some applications don’t report errors in scripts. For example, if you have an Applescript attached to a rule in Mail, if it bombs Mail won’t report the error.

Try putting the code in a try… on error… end block. In the on error section, put in a dialog box. Like this:

try
	-- insert actions here
on error the error_message number the error_number
	display dialog "Error: " & the error_number & ". " & the error_message buttons {"Cancel"} default button 1
end try

(BTW this is in the context menu in Script Editor, under “Error Handlers.”)

If the script doesn’t report an error this way, then it might be timing out. From the Applescript Language Reference:

If that’s the case, you can extend the timeout period by surrounding the code in a with timeout block like this:

with timeout of 300 seconds --wait 5 minutes
-- insert actions here
end timeout 

See if that helps!

Thanks for the reply. I’m familiar with how to use timeouts. But I’d like to know whether another script can check if that original script is running. Or for that matter, is there any other way for a user, with terminal or activity monitor or otherwise, to see if the script is running, and if possible, abort it? It seems a script is not treated like a process that could be killed? Futher elucidation of this would be appreciated!

A problem for me with this thread is your definition of “script”. If you’re running “myScript.scpt” file, you must be running it from a script editor. All of these that I have used “light up” their “Stop” button and dim their “Run” button when a script is running and reverse those when it stops. If you’re running a script application it does show up in the Activity Monitor.

Do you not use Apple’s script menu (or FastScripts)?

I use FastScripts, Bruce, and while a script is running from there, the FastScripts menu bar icon has a blue highlight that disappears when the script stops. I don’t know about the Script Menu.