What is the code that restarts the computer with NO dialog? Also is there a code that quits everything w/ no saving then restarts the computer?
Thanks
Drew 8)
What is the code that restarts the computer with NO dialog? Also is there a code that quits everything w/ no saving then restarts the computer?
Thanks
Drew 8)
this will disconnect, close all running programs, and restart when you run it.
tell application "Internet Connect"
disconnect
delay (0.1 * minutes)
end tell
set my_path to (path to me as string)
--add other apps you want to keep open here:
set protected_apps to {my_path, "loginwindow", "Dock", "SystemUIServer", "Finder", "System Events"}
tell application "System Events" to set all_apps to file of (processes)
repeat with this_app in all_apps
set this_app to this_app as string
set kill_app to true
repeat with i from 1 to (count of protected_apps)
if this_app contains (item i of protected_apps) then
set kill_app to false
exit repeat
end if
end repeat
if kill_app = true then
try
tell application this_app to quit
end try
end if
end repeat
tell application "Finder"
restart
end tell