I am using the following Applescript to run a Time Machine backup, and then shut down OS X on the computer at our store.
do shell script "/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper" repeat delay 10 if not IsProcRunning("backupd-helper") then ignoring application responses tell application "loginwindow" to «event aevtshut» end ignoring exit repeat end if end repeat on IsProcRunning(theProc) try do shell script "ps auxc | grep \"" & theProc & "\"" return true on error return false end try end IsProcRunning
It works fine and shuts down the computer unless another user is logged in, then the
Security Agent window pops up asking for an administrator username and password.
I'm curious if someone can help me add to this script the ability to check if the
Security Agent window is open, and if it is, to enter the username and password in their relative fields?