Show today's events in terminal using Applescript and Shell
applescript, calendar, shell
Solution
If you don't need to see recurring events:
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
Problem
I'm looking to create a simple CLI tool to view today's events. Eventually I want to extend the scope but starting simple. What I have currnently: ``` 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 ``` and this gives output: ``` 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 ``` I am wondering if I could get some help on extending the shell script to output the events into a list with time and description etc! Thanks :)