Jump to content
Sign in to follow this  
dbrogan

mac (Archived) AppleScript to open a specific note?

Recommended Posts

My AppleScript skills aren't what they ought to be. I'm hoping someone can tell me if it's possible to open a specific note (I'm assuming by title) with a script. I've got a note that I use as a daily scratchpad, and I'd like to write a script and give it a hotkey, so I can quickly bring that note to the front.

Thanks in advance.

Share this post


Link to post

That's not currently possible with our AppleScript interfaces, but thanks for the suggestion.

Share this post


Link to post

I think that there **IS** a way to do it via AppleScript, but it's a bit of a hack.... give this a shot if you're comfortable with that! :D

(The usual caveats apply: This is unsupported and may stop working if Evernote changes its plumbing.)

Procedure:

  • 1.) Do a Spotlight search for the title of the note you want to open via AppleScript (in your example, your daily scratchpad) and select "Show All" from the menu when the results begin to be listed;
    2.) When the Search window opens with the full results of your Spotlight Search, find your note in the listing. (List view is probably easiest for this as you can quickly skim the list to identify "Evernote Note" in the "Kind" column)
    3.) When you've found the note, highlight it and look at the bottom of the search window for the Path of the file (if you don't see a path, you can see it in the Info window by pressing Command+I).
    4.) The note name in the file path will follow a format of pXXXXX.evernote -- the X's being numbers (i.e., "p12345.evernote"). Take note of the numbers.
    5.) Open up AppleScript Editor and paste in the following code:

property notepath : "/Library/Caches/Metadata/com.evernote.Evernote/pXXXXX.evernote"
set myPath to POSIX path of (path to home folder)
set filePath to "" & myPath & notepath & ""
try
set command to "open " & quoted form of filePath
do shell script command
end try


6.) Replace the XXXXX in the "property notepath" line to the number you noted in Step 4. Save the script **AS AN APPLICATION** ("Save As..." Menu) with a descriptive name (like "Open Daily Scratchpad").

You should now be able to click on the script icon to open your note and -- assuming that the thing actually works -- then also be able to set up a keyboard shortcut to trigger this script and open your note on demand.

Hope this helps!

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...