You could try starting up the computer (or logging in) in safe mode. Hopefully that would prevent the script from being executed immediately and give you time to locate and zap it and to cancel the alarm in iCal. Then restart again in the normal way.
If you go to the Energy Saver pane in System Preferences and click the “Schedule.” button, you can safely set startup and shutdown times there.
Yea! Thanks very much kel1. It’s no longer running at startup.
Thank you for the good advice Nigel. I previously learned how to escape the loop, using the method you describe.
As for the energy saver panel, I’m aware of that too, but need to give different shut down times for each day, hence the iCal method, which now that I’ve just about mastered it with kel1’s help, works quite well.
I think I remember this one now. You need to quit all visible processes first. I hope Nigel didn’t already write about this.
set my_name to my name
tell application "System Events"
set visible of every process to true
delay 0.5
set proc_list to (name of every process whose visible is true and name is not "Finder" and name is not my_name)
end tell
repeat with this_proc in proc_list
tell application this_proc to quit
end repeat
tell application "System Events" to shut down
That didn’t work. This seems to be working. Added quitting the Finder:
set my_name to my name
tell application "System Events"
set visible of every process to true
delay 0.5
set proc_list to (name of every process whose visible is true and name is not my_name)
end tell
repeat with this_proc in proc_list
tell application this_proc to quit
end repeat
tell application "System Events" to shut down
Hope this works. I hate shutting down the computer.
set my_name to my name
tell application "System Events"
set visible of every process to true
delay 0.5
set proc_list to (name of every process whose visible is true and name is not my_name)
end tell
repeat with this_proc in proc_list
tell application this_proc to quit
end repeat
tell application "System Events" to shut down
I’m confused - I said that it is working for me. Sorry if it isn’t working for you!
I’m on 10.7, and I’m first force quitting the only app that’s open (VLC). VLC is actually strange in that even if you run an applescript telling it to quit without saving, it stays open until you move the mouse or task switch, and it will actually cancel shutdown until you do that. I worked around that by scripting an apple-tab command one minute later.
So, the scripts run from iCal, one minute apart, and the order is:
Script 1:
tell application “VLC” to quit saving no
Script 2:
tell application “System Events”
delay 0.5
key down command
keystroke tab
delay 10
key up command
end tell
Script 3:
tell application “System Events” to shut down