Skip to content

Instantly share code, notes, and snippets.

@briangonzalez
Last active November 17, 2017 22:50
Show Gist options
  • Save briangonzalez/cd19ac31de811b23e557f61bc89f7f1e to your computer and use it in GitHub Desktop.
Save briangonzalez/cd19ac31de811b23e557f61bc89f7f1e to your computer and use it in GitHub Desktop.

Revisions

  1. briangonzalez revised this gist Nov 17, 2017. 1 changed file with 27 additions and 27 deletions.
    54 changes: 27 additions & 27 deletions position-reminders.applescript
    Original file line number Diff line number Diff line change
    @@ -1,34 +1,34 @@
    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
    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}
    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
  2. briangonzalez created this gist Nov 17, 2017.
    34 changes: 34 additions & 0 deletions position-reminders.applescript
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    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