Applescript- combine multiple IF statments and an abbreviation for home folders
i'm trying to make an applescript to make a backup of some files to dropbox. My question was if it was possible to combine multiple IF statmens in my script and if it was possible to make a shorten SET name TO path, like Macintosh HD:Users:svkrzn:Dropbox to ~:Dropbox.
Here is my script:
set destination to "Macintosh HD:Users:svkrzn:Dropbox:Backup"
set safari to "Macintosh HD:Users:svkrzn:Library:Safari:Bookmarks.plist"
set safariplist to "Macintosh HD:Users:svkrzn:Dropbox:Backup:Safari_Bookmarks.plist"
set things to "Macintosh HD:Users:svkrzn:Library:Application Support:Cultured Code:Things:Database.xml"
set thingsxml to "Macintosh HD:Users:svkrzn:Dropbox:Backup:THINGS_Database.xml"
tell application "Finder"
try
set S1 to duplicate file safari to folder destination with replacing
set T1 to duplicate file things to folder destination with replacing
if exists file safariplist then
display dialog "It exists."
delete file safariplist
end if
if exists file thingsxml then
display dialog "It exists."
delete file thingsxml
end if
set name of S1 to "Safari_Bookmarks.plist"
set name of T1 to "THINGS_Database.xml"
on error
display dialog "Oops, a problem occurred duplicating the file."
end try
end tell
Thank you.
MacBook Pro (15-inch Mid 2009), OS X Mountain Lion, Crucial 8GB DDR3, Samsung 830 128GB