为什么我不能使用变量来设置 iCal 事件?
我可以使用 iCal 举办新活动。
tell application "iCal"
tell calendar "Todo"
set new_event to make new event at end of events
tell new_event
set start date to date "Friday, May 6, 2011 4:00:00 PM"
set end date to date "Friday, May 6, 2011 4:30:00 PM"
set summary to "Feed ferret"
set location to "Home 2"
set allday event to false
set status to confirmed
end tell
end tell
end tell
但是,当我使用变量替换字符串时,出现错误。
tell application "iCal"
tell calendar "Todo"
set new_event to make new event at end of events
set m_date to "Friday, May 6, 2011 4:00:00 PM" --> variable m_date
tell new_event
set start date to date m_date --> Error
set end date to date "Friday, May 6, 2011 4:30:00 PM"
set summary to "Feed ferret"
set location to "Home 2"
set allday event to false
set status to confirmed
end tell
end tell
end tell
为什么我不能使用变量来设置 iCal 事件?
I can use iCal to make a new event.
tell application "iCal"
tell calendar "Todo"
set new_event to make new event at end of events
tell new_event
set start date to date "Friday, May 6, 2011 4:00:00 PM"
set end date to date "Friday, May 6, 2011 4:30:00 PM"
set summary to "Feed ferret"
set location to "Home 2"
set allday event to false
set status to confirmed
end tell
end tell
end tell
However, when I use a variable to replace the string, I got an error.
tell application "iCal"
tell calendar "Todo"
set new_event to make new event at end of events
set m_date to "Friday, May 6, 2011 4:00:00 PM" --> variable m_date
tell new_event
set start date to date m_date --> Error
set end date to date "Friday, May 6, 2011 4:30:00 PM"
set summary to "Feed ferret"
set location to "Home 2"
set allday event to false
set status to confirmed
end tell
end tell
end tell
Why can't I use variables for setting up iCal event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为“date”是一个将字符串转换为 ical 接受的日期格式的函数,所以您只需将“date”放入变量
ll 中
结束告诉
because 'date' is a function that converts the string to a date format that ical accepts so you simply must put 'date' in your variable
ll
end tell