Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
今日秀';使用Applescript和Shell在终端中设置事件_Shell_Calendar_Applescript - Fatal编程技术网

今日秀';使用Applescript和Shell在终端中设置事件

今日秀';使用Applescript和Shell在终端中设置事件,shell,calendar,applescript,Shell,Calendar,Applescript,我希望创建一个简单的CLI工具来查看今天的事件。最终我想扩展范围,但从简单开始 我目前拥有的: echo "set today to (current date) tell application \"Calendar\" tell calendar \"testemail@gmail.com\" set curr to every event whose start date is greater than or equal to today end tell

我希望创建一个简单的CLI工具来查看今天的事件。最终我想扩展范围,但从简单开始

我目前拥有的:

echo "set today to (current date)

tell application \"Calendar\"
    tell calendar \"testemail@gmail.com\"
        set curr to every event whose start date is greater than or equal to today
    end tell
end tell" | osascript 
这就产生了输出:

event id A2794321-6987-4DE0-BC70-DD75FFD5D770 of calendar id 87CF6FE8-B408-4931-8734-FDCBD95857C5, event id A62028B5-9F20-49F0-8660-94A55DC3E2BF of calendar id 87CF6FE8-B408-4931-8734-FDCBD95857C5
我想知道我是否可以在扩展shell脚本以将事件输出到带有时间和描述等的列表中得到一些帮助


谢谢:)

获取事件(或任何applescript对象)更多信息的好方法是询问其属性。 之后,您将知道需要哪些参数。这就是描述。
另一件事是应用程序的字典,您可以从applescript编辑器中访问该字典:通过该字典,您应该能够找到获取列表的方法。

如果您不需要查看重复事件:

set d to current date
set hours of d to 0
set minutes of d to 0
set seconds of d to 0
set out to ""
tell application "Calendar" to tell calendar "Calendar Name"
    repeat with e in (events where start date > d - 1 and start date < d + 86400)
        set out to out & time string of (get start date of e) & " " & ¬
            time string of (get end date of e) & " " & ¬
            summary of e & linefeed
    end repeat
end tell
将d设置为当前日期
将d的小时数设置为0
将d的分钟数设置为0
将d的秒数设置为0
出发去“
告诉应用程序“日历”告诉日历“日历名称”
重复e in(开始日期>d-1且开始日期
不幸的是,你在浪费时间:iCal/Calendar的AppleScript界面糟糕透顶。按日期范围获取事件时,仅显示一次性事件;重复发生的事件不会。我建议调查一下,看看是否能做得更好。