0
我試圖讓applescript讀取今天的ical事件並將它們寫入文件。代碼如下:使用applescript將iCal數據寫入文件
set out to ""
tell application "iCal"
set todaysDate to current date
set time of todaysDate to 0
set tomorrowsDate to todaysDate + (1 * days)
repeat with c in (every calendar)
set theEvents to (every event of c whose start date ≥ todaysDate and start date < tomorrowsDate)
repeat with current_event in theEvents
set out to out & summary of current_event & "
"
end repeat
end repeat
end tell
set the_file to (((path to documents folder) as string) & "DesktopImage:ical.txt")
try
open for access the_file with write permission
set eof of the_file to 0
write out to the_file
close access the_file
on error
try
close access the_file
end try
end try
return out
的iCal的項目越來越正確返回,並在文件夾中的文件/ DesktopImage正確地創建了文件ical.txt,但該文件是空白。
即使我代替
write out to the_file
與
write "Test string" to the_file
它仍然出現空白
什麼想法?
Ty
作品一個款待。謝謝 – Guy 2010-04-21 08:43:20