Am I busy? Finding out whether I'm in a meeting or not using AppleScript

Peter Rukavina

Today I’m in a “what’s my status” moon, and following on from setting my Slack status if I’m in a Zoom, here’s an AppleScript to find out whether I’m in a meeting or not:

-- Am I in an event, according to my Calendar?
set now to current date
set theEvents to ""
tell application "Calendar"
	set a_calendar to first calendar where its name = "Peter Rukavina"
	tell a_calendar
		set the_events to (every event whose start date < now and end date > now)
		repeat with an_event in the_events
			set theEvents to theEvents & summary of an_event
		end repeat
	end tell
end tell
return theEvents

With that script in place (and edited to identify you particular calendar in place of mine), you can retrieve your current status from the command line with:

osascript am_I_in_an_event.scpt 

This will return nothing if you’re not in an event, and the name of the event if you are (if you’re in more than one event at the same time, it will simply smush them together).

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, listen to audio I’ve posted, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). 

You can subscribe to an RSS feed of posts, an RSS feed of comments, or a podcast RSS feed that just contains audio posts. You can also receive a daily digests of posts by email.

Search