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.
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
The legal tricks-Learn Your Self
Latest gadgets,softwares,hardware,reviews,programming and campuses, game cheats ext......
Quote:
property querylist : {"backupd"}
Labels: MAC OS, Operating System
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment