Page 1 of 1

indexing Evernote notes with LaunchBar finally solved

Posted: Sun Feb 19, 2012 3:34 am
by bigcloits
The Evernote mothership updated the AppleScript dictionary, and you can now grab the note link. This means that it’s now quite trivial to go through a selection of notes, getting the note link and making a .webloc file out of each one. LaunchBar can index … boom. Pretty easy.

Code: Select all

tell application "Evernote"
   set noteList to selection
   repeat with currentEvernote in noteList
      set noteTitle to title of currentEvernote -- the noteTitle will also be the filename
      set noteURL to note link of currentEvernote

-- you may want to replace other characters in titles! colons are particularly important to replace, because they will break the POSIX path if you don’t
      set noteTitle to my replace_chars(noteTitle, ":", " - ")

      set weblocXML to "\"<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE plist PUBLIC '-//Apple//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'><plist version='1.0'><dict><key>URL</key><string>" & noteURL & "</string></dict></plist>\""
      set filepath to "path:to:wherever:you:wanna:put:them" & noteTitle & ".webloc"
      set shell_script to "echo  > " & the quoted form of the POSIX path of filepath & " " & weblocXML
      do shell script shell_script with administrator privileges
   end repeat
end tell

on replace_chars(this_text, search_string, replacement_string)
   set AppleScript's text item delimiters to the search_string
   set the item_list to every text item of this_text
   set AppleScript's text item delimiters to the replacement_string
   set this_text to the item_list as string
   set AppleScript's text item delimiters to ""
   return this_text
end replace_chars

Re: indexing Evernote notes with LaunchBar finally solved

Posted: Fri May 04, 2012 6:20 pm
by Nik
I put together a similar script, but this just makes a single bookmarks file that LaunchBar can index. A little less clutter than weblocs all over the place, plus it has richer text for indexing.

http://nik.me/crappysoftware/evernote-bookmarking-tools

Re: indexing Evernote notes with LaunchBar finally solved

Posted: Wed May 09, 2012 7:11 pm
by bigcloits
Looks nifty, Nik, thanks. Nice idea to put them in a file.

Re: indexing Evernote notes with LaunchBar finally solved

Posted: Tue Aug 07, 2012 5:46 pm
by tsvoronos
bigcloits - I keep getting an error about various note titles being too long - can I fix this without having to rename all my notes with long titles?

Nik - as far as I can tell your script only exports notes with URLs embedded in the note, is that correct? I'm interested in indexing ALL my notes on Evernote.

Re: indexing Evernote notes with LaunchBar finally solved

Posted: Fri Aug 17, 2012 6:05 pm
by jakousers
Hey! Came across this thread while googling this. Glad you guys found a solution.

I'm not nearly as technical as you guys who worked this out, and not even gonna try to implement this solution. This seems like it could be a very common request though, so here's hoping that they can get a more out-of-the-box solution for this down the line.