Skip to content

Instantly share code, notes, and snippets.

@oderwat
Created October 22, 2017 11: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 oderwat/f87cdb53a559a1bd3fb31a59891eaa9f to your computer and use it in GitHub Desktop.
Save oderwat/f87cdb53a559a1bd3fb31a59891eaa9f to your computer and use it in GitHub Desktop.
Little Script which tells Bear to focus the window, reset it's state and place the cursor in the search field
tell application "System Events" to tell process "Bear"
set frontmost to true
-- show all notes
click menu item 1 of menu 1 of menu bar item 5 of menu bar 1
-- search in (all) notes
click menu item 1 of menu 1 of menu item 22 of menu 1 of menu bar item 4 of menu bar 1
tell application "System Events"
-- press delete to clear the search field
key code 51
-- press tab to switch to note list
key code 48
-- press cmd + home to move to the top of the note list
key code 115 using { command down }
end tell
-- activate search again
click menu item 1 of menu 1 of menu item 22 of menu 1 of menu bar item 4 of menu bar 1
end tell
@oderwat
Copy link
Author

oderwat commented Oct 22, 2017

Can be used like described here: http://blog.fosketts.net/2010/08/09/assign-keyboard-shortcut-applescript-automator-service/

This script is part of my Alfred 3 workflow BearHunter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment