Help with a script for elder friend
First off, with apologies, I am not a script familar person at all. I have an elderly friend who is switching to Mac for the first time. I wanted a way to close all open programs, with a prompt to save any open files and then run a Time Machine backup and shut down - preferably without restarting next day with any windows opening automatically. Time Machine is set to run every hour but she's a writer and could lose work if Time Machine doesn't run before shutting down for the night. So I searched and found some small scripts that I tried to put together. I think it works but after Time Machine runs it waits a very long time before shutting down. I'm wondering if some of you kind folks could refine this for me. (I do realize that automator has a quit all programs that I can save as an app but I'm trying to make this a one step 'app' process.)
So what I have is this:
tell application "System Events" to set the visible of every process to true
set white_list to {"Finder"}
try
tell application "Finder"
set process_list to the name of every process whose visible is true
end tell
repeat with i from 1 to (number of items in process_list)
set this_process to itemi of the process_list
if this_process is not in white_list then
tell applicationthis_process
quit
end tell
end if
end repeat
on error
tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
end try
do shell script "/bin/bash -c '/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper > /dev/null 2>&1 &'"
repeat
delay 5
if not IsProcRunning("backupd") then
ignoring application responses
tell application "Finder" to shut down
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
.... frankly I don't understand most of this in reality but it's a need I'd like to help her with on her Mac Mini.
Many Thanks,
Brenda
MacBook Air, Mac OS X (10.7), 13" Intel top MBAi model & Iphone 4