Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# This is an action script for TextBar corresponding to this gist:
# By Max Melzer
open /Applications/; # If any line of the list is clicked, open the default Calendar app.
# The following code begins a multi-line applescript. The repeat loop makes sure that the script waits until Calendar has finished opening.
osascript -e '
set calendarDidFinishLaunching to false
repeat while calendarDidFinishLaunching is false
tell application "System Events" to set frontApp to name of first application process whose frontmost is true
if frontApp is "Calendar" then set calendarDidFinishLaunching to true
end repeat
tell application "System Events" to keystroke "t" using command down' # This simulates a press of CMD-T, which tells Calendar to jump to the current day. You could parse the title of an event and jump right to that event, but I havent implemented this functionality yet.
if [[ $TEXTBAR_TEXT == *"Neuer Eintrag"* ]] ; then # This parses the clicked line and checks if it is our link to create a new entry.
osascript -e 'tell application "System Events" to keystroke "n" using command down' # If it is we simulate a press of CMD-N, opening the quick entry pane of calendar, ready for your input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment