Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to stop an Applescript

I wrote an applescript that tells the finder to run an application every hour, the problem is that once this applescript is running, the computer is not able to shut down , restart or log out.

Is there a way to tell the applescript that the OS X is attempting to close it?

Thanks.

Mac Mini, Mac OS X (10.4.3)

Posted on Jun 13, 2006 7:15 AM

Reply
Question marked as Best reply

Posted on Jun 13, 2006 8:13 AM

This probably isn't the best way, but using Terminal you can type "ps -A' (no quotes) to find out the PID (Process ID) of your script then use "kill [pid]" to stop it.
5 replies

Jun 13, 2006 9:09 AM in response to Sagesse

Thanks for your answer, but that's not what I'm looking for.

Perhaps I should explain what I need more thoroughly.

I'm running an AppleScript, and while it is running someone might shutdown or restart the Mac.
If this happens, my applecript won't let the Mac to Restart, nor to ShutDown. Therefore, unless the user kills the applescript process before he or she wants to Restart or shutdown, that won't occur.

I thought, I might add an

if (something happens) then
Allow to shutdown or Restart
end if

but I'm still looking for that "something happens"

So let's get back to my original question. Is there a solution to this problem?

Thanks

Jun 13, 2006 7:17 PM in response to MartinPerilli

I'm not much of an AppleScripter, so again there may be a much better way than the idea that follows.

You could write scripts called "ShutdownPlus" and "RestartPlus" that check if your script is running, stops it if it is, and then does either the shutdown or the restart.

I'm not suggesting this for the long term, but it should be easy to code and get you something until you find a "right" answer.

How to stop an Applescript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.