![]() If displaymethod contains “Notify” then notify(bktime, thebytes) If displaymethod contains “Growl” then growl(bktime, thebytes) Set thebytes to text 1 thru 3 in thebytes & “Mb backed up in “ & thefiles Set thebytes to text 1 thru 2 in thebytes & “Mb backed up in “ & thefilesĮlse if thebytes is greater than or equal to 100 and thebytes is less than 1000 then Set thebytes to text 1 thru 1 in thebytes & “Mb backed up in “ & thefilesĮlse if thebytes is less than 100 and thebytes is greater than or equal to 10 then ![]() Set thebytes to “1Mb backed up in “ & thefilesĮlse if thebytes is less than 10 and thebytes is greater than or equal to 1 then Set thebytes to text 1 thru 4 in thebytes & “Gb backed up in “ & thefilesĮlse if thebytes is less than or equal to 1 then If thebytes is greater than or equal to 1000 then tests what the size and reports it according to whether is between 1–10, 10–100, 100–1Gb and constructs the etxt reference accordingly Set thebytes to text ((offset of “bytes” in bkfiles) + 30) thru ((offset of “files =” in bkfiles) - 7) in bkfiles ![]() Set thefiles to text ((offset of “totalfiles” in bkfiles) + 13) thru -4 in bkfiles & “ files” Set bkfiles to do shell script “defaults read /private/var/db/.TimeMachine.Results Progress” Set bktime to “Time Machine backup “ & bktimehour & bktimemin Gets the number of files in the alst backup and the total size of data backedup in Mb Set bktimehour to bktimehour + ((time to GMT) / 3600) as integer Set bktimehour to text 1 thru 2 of bktime Set bktime to text 12 thru ((offset of “ +0000” in bktime) - 4) in bktime Gets the time of the last run as a simple time reference and corrects an error in which the time is reported an hour earlier than actually is If (do shell script “defaults read com.TMscriptprefs lastTM”) is equal to timestamp then return Check that the last time the script ran wasn’t on the same backup cycle, and quit the script if it was Set timestamp to replace_chars(timestamp, “ “, “”) Set timestamp to replace_chars(timestamp, “:”, “”) Set timestamp to replace_chars(timestamp, “-”, “”) Set timestamp to text 1 thru ((offset of “ +0000” in bktime) - 1) in bktime Set bktime to do shell script “defaults read /private/var/db/.TimeMachine.Results BACKUP_COMPLETED_DATE” Set displaymethod to “Notify” - change this to “Growl” to use Growl or “Notify” to use Notification Scripting Get the time Time Machine last ran and turn it into a single number ID (I daresay you can avoid both by using something like Eventscripts but I didn’t want to spend £4 to make something happen that a bit of under the hood work can achieve.) Then use Lingon to set a launchagent that runs (say every 15 minutes) and runs the script (to do that, put ‘osascript /path/to/whereveryou/saved/the.scpt’ in the ‘what’ field.)Īlternatively, download this zip archive which has the script itself, the prefs file and the launchagent file you’ll need to change the launchagent key location to wherever you end up saving the script. In order to make the script work, you need to create a preference file called ‘TMscriptprefs’ with a key called ‘lastTM’ in it, and save that to your user Library Preferences folder. It can display the message in either Growl, or using Notification Scripting - edit the first declaration to change it. I’ve done a script which places a notification in notification center after every backup, detailing the size of the backup and the number of files backed up, as well as the time. Applescript to use Notification Center to give Time Machine updates
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |