Re: [問題] 自動執行iSync同步
推
04/10 02:26,
04/10 02:26
→
04/10 02:59,
04/10 02:59
昨天邊看歐冠邊寫了一個
======
-- 把這個程式設成登入時執行
if application "iSync" is not running then
tell application "iSync" to run
delay 10
end if
tell application "iSync"
set lastSyncDate to last sync
quit
end tell
-- 檢查 iSync 有沒有在執行, 沒有的話執行
-- 讀入上次同步的時間
set dateNow to current date
-- 以上只會在本程式啟動時執行, 以下是迴圈
repeat
-- 每天更新現在日期
if dateNow is not (current date) then
set dateNow to current date
end if
-- 檢查現在是不是週日, 以及今天有沒有同步過
-- 如果沒有, 則執行 iSync, 同步, 然後更新上次同步時間
if dateNow is Sunday and lastSyncDate is not dateNow then
tell application "iSync"
run
delay 3
synchronize
repeat while syncing is true -- 這邊改了
delay 1
end repeat
set lastSyncDate to last sync
quit
end tell
end if
-- 六小時(21600 秒)之後再回來重作一次
delay 21600
end repeat
======
我不太用 iSync, AppleScript 也不算太熟
希望可以提供參考, 如果有砂鍋大的 bug 也請提出來
(我甚至不確定 delay 21600 行不行得通 orz)
--
我承認只是想練習一下...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.100.141
推
04/10 22:06, , 1F
04/10 22:06, 1F
→
04/10 22:41, , 2F
04/10 22:41, 2F
※ 編輯: uranusjr 來自: 220.132.100.141 (04/10 22:42)
推
04/10 23:03, , 3F
04/10 23:03, 3F
→
04/10 23:04, , 4F
04/10 23:04, 4F
→
04/10 23:04, , 5F
04/10 23:04, 5F
MAC 近期熱門文章
13
34
PTT數位生活區 即時熱門文章