Show today's events in terminal using Applescript and Shell

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 \"\"
        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 :)


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

A good way to get more info on the event (or any applescript object) is to ask for the properties of it. After that you will know which parameters you need. That's for the description. Another thing is the dictionary of the application, that you can access from your applescript editor : from this you should be able to find a way to get your list.

Need Your Help

vim script to insert ascii-art formulas

formula vim maxima ascii-art

I try to use Vim as much as I can to learn it.

ArrayList of serializable objects as intent extra not received by broadcast receivers

android serialization android-intent broadcastreceiver intentservice

I am sending a broadcast with the intent containing an ArrayList of serialized objects as a intent extra.