AppleScript to Shutdown
Im new to AppleScript, and was wondering how to write one that would close all open applications and shutdown. Also, it would be nice if there were no interface whatsoever.
do shell script "shutdown -h now" with administrator privileges username "<youradminusername>" password "<youradminpassword>"
tell application "System Events"
set ProcNm_ to name of every application process whose visible is true
repeat with i_ from 1 to count items of ProcNm_
set TarProc_ to item i_ of ProcNm_
try
tell application TarProc_ to quit
end try
end repeat
shut down
end tell
AppleScript to Shutdown