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?
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.
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.
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?
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.