我正在尝试制作一个applescript来将一些文件备份到Dropbox。我的问题是是否可以在我的脚本中组合多个 IF statmen,以及是否可以缩短 SET name TO 路径,例如 Macintosh HD:Users:svkrzn:Dropbox to ~:Dropbox。
这是我的脚本:
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