【发布时间】:2018-06-04 23:24:24
【问题描述】:
我正在尝试创建一个脚本来记录我的当前时间和完成时间 做一个特定的动作,他们用这个时间变量发送了一封电子邮件,并用这个时间变量创建了一个日历事件:
set FinsihDate to (current date) + 10 * hours + 30 * minutes
set startingDate to (current date)
set plistR to {FinsihDate:FinsihDate, starteddate:current date}
tell application "System Events"
set plistf to make new property list file ¬
with properties {name:"~/Desktop/MY_Time.plist"}
set plistf's value to plistR
end tell
## Email
property lastWindowID : missing value
tell application "Mail"
set windowIDs to id of windows
if windowIDs does not contain lastWindowID then
set newMessage to make new outgoing message with properties {subject:"Started early", content:"Hi ..., \n \nI started early today : " & (current date) & ", I will leave at " & FinsihDate & "\n \nKind Regards,\nKevin " & return & return}
tell newMessage
set visible to true
make new to recipient at end of to recipients with properties {name:"Name", address:"@apple.com"}
end tell
activate
set lastWindowID to id of window 1
else
tell window id lastWindowID
set visible to false
set visible to true
end tell
activate
end if
end tell
set startDate to date (current date)
set endDate to date FinsihDate
tell application "Calendar"
tell (first calendar whose name is "calendar")
make new event at end of events with properties {summary:"Work", start date:startDate, end date:endDate, description:"ITS Fraud Prevention", location:"Apple"}
end tell
end tell
-
时间格式
电子邮件上的时间格式是“2018 年 6 月 4 日星期一 14:25:57”,而我只想要 14:25
我试过这个:
set myTime to (time string of (current date)) + 10 * hours + 30 * minutes
结果:错误“无法将 \"14:27:02\" 转换为类型编号。”号码 -1700 从“14:27:02”到数字
- 日历
创建日历事件时出现此错误
错误“无法获取日期(日期\“2018 年 6 月 4 日星期一 14:29:34\”)。” 编号 -1728 从日期(日期“2018 年 6 月 4 日星期一 14:29:34”)
【问题讨论】:
标签: date calendar applescript