The legal tricks-Learn Your Self

Latest gadgets,softwares,hardware,reviews,programming and campuses, game cheats ext......

Run a Time Machine backup then shut down

Here’s an AppleScript I use to run a Time Machine backup, and then shut down the machine. As is the case with most shut down scripts, I suppose it would be a good idea to quit whatever programs you know of that are open before running the script. 

Quote:
property querylist : {"backupd"}
property app_is_up : missing value
set app_is_up to false
do shell script 
"/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-help
er > /dev/null 2>&1 &"

repeat
delay 10
repeat with i in querylist
set the_ps to paragraphs of (do shell script "/bin/ps -acx")
tid("/")
repeat with _line in the_ps
if _line is "" then
else
if _line contains i then
set app_is_up to true
end if
end if
end repeat
tid("")
end repeat
if app_is_up then
set app_is_up to false
else 
tid("")
ignoring application responses
tell application "loginwindow" to «event aevtshut»
end ignoring
exit repeat
end if
end repeat
on tid(s)
set my text item delimiters to s
end tid

0 comments: