0
我想讓一個applescript將一些文件備份到dropbox。我的問題是,如果可以在我的腳本中合併多個IF statmens,並且可以縮短SET名稱TO路徑,如Macintosh HD:用戶:svkrzn:Dropbox to〜:Dropbox。Applescript-結合多個IF語句和家庭文件夾的縮寫
這裏是我的腳本:
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