Skip to content

Instantly share code, notes, and snippets.

@briangonzalez
Last active November 17, 2017 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briangonzalez/cd19ac31de811b23e557f61bc89f7f1e to your computer and use it in GitHub Desktop.
Save briangonzalez/cd19ac31de811b23e557f61bc89f7f1e to your computer and use it in GitHub Desktop.
activate application "Reminders"
tell application "Finder"
set _b to bounds of window of desktop
set _width to item 3 of _b
set _height to item 4 of _b
end tell
tell application "System Events"
try
-- Attempt to show the sidebar. If it throws
-- an error, we know the sidebar is already
-- open, so we close it.
-- If it works, we immediately close it.
tell process "Reminders"
click menu item "Show Sidebar" of menu "View" of menu bar 1
end tell
keystroke "s" using {option down, command down}
on error errMsg
-- Close the sidebar because it's open.
keystroke "s" using {option down, command down}
end try
-- Put it in the upper right hand corner.
set position of first window of application process "Reminders" to {_width - 300, 40}
set size of first window of application process "Reminders" to {560, 400}
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment