刚写了一段同步 mac 与 android 手机 特定文件夹的 script 😄
Last active
August 29, 2015 13:57
-
-
Save CaptainJH/9733305 to your computer and use it in GitHub Desktop.
AppleScript Samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" | |
set folder_video to folder "Documents:Projects:temp" of home | |
set file_name_list to (name of files in folder_video whose name ends with "flv") | |
count file_name_list | |
set folder_dest to folder "temp" of second disk | |
set file_name_list_dest to name of every file of folder_dest | |
count of file_name_list_dest | |
repeat with f_ref in file_name_list | |
if f_ref is not in file_name_list_dest then | |
log f_ref | |
get name of (file f_ref of folder_video) | |
duplicate (file f_ref of folder_video) to folder_dest | |
end if | |
end repeat | |
eject second disk | |
end tell |
先还是要称赞一下 Apple 的 Mail,比Windows 的 Live Mail 要强太多了:+1:。之前我只是简单的输入了一下Google Apps的账号信息,它就能替我同步邮件了,甚至我都没有在Google Apps 中enable 它的 smtp 和 imtp,太神奇了。而到了Live Mail 这边,就不行了,必须一步一步设置,甚至连端口号,都得我从网上去查。但是这样一来,就带了一点麻烦,因为之前 Mail 已经为我同步了邮件,enable Google Apps 的 smtp 和 imtp 之后,它又替我把每一封邮件重复下载了一遍。还好,我用下面这段 AppleScript 把重复的邮件都删除了,非常好的练手机会。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Mail" | |
tell second account | |
tell mailbox "INBOX" | |
set c to count of messages | |
set dup to 0 | |
set dup_msg to {} | |
repeat with i from 1 to (c - 1) | |
set m to item i of messages | |
set m_next to item (i + 1) of messages | |
if date sent of m = date sent of m_next then | |
set dup to dup + 1 | |
if id of m < id of m_next then | |
set end of dup_msg to m | |
else | |
set end of dup_msg to m_next | |
end if | |
end if | |
end repeat | |
get (c - dup) | |
log dup | |
repeat with item_ref in dup_msg | |
delete item_ref | |
end repeat | |
end tell | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment