I back up my macbook on two different drives almost daily, one at my work place and one at home. I would like to automate this using applescript and I already found the code that does almost exactly what I want. The code is
property pth : "Macintosh HD:Library
references:"
property d1name : "Backup Disk 1"
property d1 : "com.apple.TimeMachine.Disk1.plist"
property d2name : "Backup Disk 2"
property d2 : "com.apple.TimeMachine.Disk2.plist"
property active : "com.apple.TimeMachine.plist"
do shell script "defaults write com.apple.TimeMachine AutoBackup -bool false"
if (list disks) contains d1name then
tell application "Finder" to if exists (pth & d1) then
set name of file (pth & active) to d2
set name of file (pth & d1) to active
end if
else if (list disks) contains d2name then
tell application "Finder" to if exists (pth & d2) then
set name of file (pth & active) to d1
set name of file (pth & d2) to active
end if
end if
do shell script "defaults write com.apple.TimeMachine AutoBackup -bool true"
The only problem is that Finder asks for my administrator password twice during the script to rename the plist files in the system folder. I tried changing the "sharing and permissions" option for these particular files through the "Get info" dialog to to enable read/write but this didn't appear to have any effect.
How should the script be modified so that it would rename the plist files but not ask for system password? Thanks in advance.
property pth : "Macintosh HD:Library
property d1name : "Backup Disk 1"
property d1 : "com.apple.TimeMachine.Disk1.plist"
property d2name : "Backup Disk 2"
property d2 : "com.apple.TimeMachine.Disk2.plist"
property active : "com.apple.TimeMachine.plist"
do shell script "defaults write com.apple.TimeMachine AutoBackup -bool false"
if (list disks) contains d1name then
tell application "Finder" to if exists (pth & d1) then
set name of file (pth & active) to d2
set name of file (pth & d1) to active
end if
else if (list disks) contains d2name then
tell application "Finder" to if exists (pth & d2) then
set name of file (pth & active) to d1
set name of file (pth & d2) to active
end if
end if
do shell script "defaults write com.apple.TimeMachine AutoBackup -bool true"
The only problem is that Finder asks for my administrator password twice during the script to rename the plist files in the system folder. I tried changing the "sharing and permissions" option for these particular files through the "Get info" dialog to to enable read/write but this didn't appear to have any effect.
How should the script be modified so that it would rename the plist files but not ask for system password? Thanks in advance.