Search
« A Quick Fix for Swype Users | Main | PDF Quick Save in Word 2007 »
Friday
Jul082011

Search Evernote from Alfred (again...)

PLEASE NOTE: Alfred 2.0 was released into Beta in January 2013. The search is now included as part of the Evernote Search+ workflow for Alfred 2.0.


About a month ago I wrote a script (and a blog post) to allow me to search Evernote direct from the Alfred app on my Mac. Today Andrew Pepperrell (the developer of Alfred) released a developer build with some nice new features and one of these makes the process of setting up my little search even simpler!

EDIT: The beta testing is over and this is now a standard Alfred feature


So at the time of writing, this new version of Alfred really is hot off the keyboard. It may be by the time you're reading this post that the new features are on general release, but if not I grabbed my copy of Alfred 0.9.9 dev 1 build from the dev download page. The feature you're going to need available is that of importing an extension.



The packaged up version of my search Evernote script is available to download using the link below. Save the zip file to a convenient location then open up Alfred's preferences. Navigate to the "Extensions" settings and simply drag and drop the zip file onto the window. On the new pop-up just click the "Import" button and you'll now be looking at the Search Evernote extension.



Rather than running via osascript from the terminal, Alfred now allows AppleScript to be called directly. The script is almost identical to that posted previously, but now fits to the couple of lines of AppleScript Alfred uses to pass the query parameters in.



For more on how it all works go back and check out my previous post, but the real beauty is you can just import with a drag and drop and you're ready to search.


PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (19)

Big thanks for the script! I love it so much I made my own version which always executes the searches in the same window, and putting Evernote up front after the search. Read about it and download the extension here: http://tumblr.com/xt945g59t1

Great work! /Pontus

August 17, 2011 | Unregistered CommenterPontus Sundén

Have to say that we are living in wonderful times. Thanks for the help, the greatly improved installation procedure (thanks Andrew) and the refined extension (Pontus).

Drinks all round.

r

August 17, 2011 | Unregistered CommenterRichard Levenson

Cheers! ;)

August 18, 2011 | Unregistered CommenterPontus Sundén

This works great! Many thanks!

December 6, 2011 | Unregistered CommenterJas

sorry if I am being thick (I am new to both Alfred and Evernote) but what sort of advantage does that give you compared to using the global "Evernote Search" shortcut (which works whether the Evernote app is running or not)?

December 14, 2011 | Unregistered Commenterjez foreg

Jez.

I'm not sure what global Evernote search you're referring to, but I'll see if I can cover off a few possibilities.

When Evernote is running CTRL+CMD+E opens the Evernote app for a search. This isn't available is Evernote isn't running (not for me at least).

CMD+SPACE opens spotlight search which can search Evernote , but you can't use any advanced search syntax specific to Evernote (e.g. tags and notebooks).

Using Alfred you can trigger the search even when Evernote is closed and make use of the advanced search syntax. You also get the approach that Alfred becomes your central start point for yet another action. Centralising just gives familiarity and you might have to remember fewer hot keys, but the downside is you might have to remember another special term (the one to trigger the Evernote search) - I personally think it just balances out.

Does that cover it? I'm sure others can probably add a few advantages for triggering the search from Alfred.If I've missed the mark let me know what you mean and I'll have a second pass.

December 14, 2011 | Registered CommenterStephen Millard

Cheers for the extension, works great! :) Am quite new to both Alfred and AppleScript, so well impressed with your work so far.

Thanks again!

January 8, 2012 | Unregistered CommenterGleb Reys

The drag and drop functionality is great, but it should be noted that Extensions requires the user to buy the Powerpack feature. Free users are unable to drop it in like that.

Rich

January 16, 2012 | Unregistered CommenterRich Duprey

Your extension uses applescript as i commented in your other post. Same problem here: each search word gets surrounded by its own quotes.

March 2, 2012 | Unregistered CommenterRobert

Hi Robert.

I've done a quick bit of testing...

Enter into Alfred: $en "term1 term2"
Resulting search in Evernote: "term1 term2"

Enter into Alfred: $en term1 term2
Resulting search in Evernote: "term1" "term2"

I then did a direct bit of AppleScript (outside of Alfred):

tell Application "Evernote"
open collection window with query string "term1 term2"
end tell

This again resulted in: "term1" "term2"

So I guess that the AppleScript interface to Evernote is adding in the additional double quotation marks.

So I tried a couple of quick comparisons between the search results for:
term1 term2
vs.
"term1" "term2"
I got identical results sets back each time I varied the search terms.

Can you provide some details around when theses two search strings produce differing results?

March 3, 2012 | Registered CommenterStephen Millard

It's not quite working for me. There seems to be no actual search action taking place in Evernote. I've re-read the instructions a couple of times and I don't think I missed anything. Download plugin, drag&import, and then try it. No luck though. Evernote just seems to sit idly. Any suggestions? Is it due to a recent Evernote upgrade? Can't wait to use this!

Thanks ahead of time for any responses, and thanks Stephen Millard for building this.

July 24, 2012 | Unregistered CommenterMarkR

Nevermind on the last post. I THOUGHT I was on the latest Evernote version. I did the update and then it worked. Thanks.

July 24, 2012 | Unregistered CommenterMarkR

Hello and thank you very much for this tremendous help!!

I've just started Alfred and in the parameters to enter the extension, they are a few new ones that don't appear in your picture (that's why I think they are new). They propose : Auto Detect, Optional Parameter or Required Parameter. I've tried all of them but everytime the search opens in google even though I don't have any other hotkey.

If you could give me any advise, that would be simply amazing!

Thans you again!

August 25, 2012 | Unregistered CommenterBéryl

Beryl.

That doesn't sound right at all. I'm running the latest version of Alfred (1.3.1 (261)) and I have the parameter set to auto detect (screen shot here) and it is working just fine.

Presumably you do have the PowerPack installed to be able to add the extension, so I'd suggest removing it and re-adding it.

Also when you type in the search into Alfred does it tell you it is going to search Google or Evernote (like this screen shot).

September 27, 2012 | Registered CommenterStephen Millard

I have been using Alfred for quite sometime but I bought the powerpack very recently and I am also new to the Apple Script thing. This extension is great and I hope it gets more awesome. Thanks for the great extension.

December 6, 2012 | Unregistered CommenterCSA

I'm curious about tags in this extension. Trying to search for a tag term doesn't yeild all the results that it should. Also, is there a way to bring the evernote window to the front when the search is completed instead of having the window in the background? Thanks for the extension, its a great help.

January 29, 2013 | Unregistered Commentermurphyj6

Hi. Am having real issues with getting the extension to work. Have latest Alfred and most updated Evernote (5.0.7). Doesn't open a new Evernote window if Evernote not already loaded in the background. Also if there is a search term already in Evernote it defaults to this rather than the new Alfred search term. Any help would be greatly appreciated.

March 13, 2013 | Unregistered Commentershan

Shan.

By latest Alfred I assume you don't actually mean version 2.0 (which is available and should be on official release within the next few days).

The extension was not designed to open Evernote if it were not already running. You could add a command to the script to tell it to open Evernote before the 'tell application "Evernote"' block of code

i.e.
tell application "Evernote" to activate

The pre-existing search term is however not what I expected. I'm positive that when I first created the extension that this was not the behaviour as I carried out several successive searches without this occurring.

Looking at the way the search is behaving, it appears to be that the search is no longer populating the search field in the desktop client. So when there is no search specified in the client in the field, the search is carried out but the search parameters are not copied to the field. If a search term is already specified in the client then when the AppleScript triggers a new search, the search parameters already in the search box take precedence.

So this I believe is a bug in the Mac client. I'll submit an issue to Evernote support. Hopefully they will correct it in a future Mac client release. I'll add something back here as and when I hear more.

Regards,

Stephen.

March 14, 2013 | Registered CommenterStephen Millard

Actually scratch that previous comment regarding it being an issue in Evernote. I've run the script in AppleScript and it works fine. When run from within Alfred however it does not. I added some display dialogs in and set it to run in the foreground and could see the search parameters being passed in (just like in the standalone AppleScript), but when it executes in Evernote the search field simply doesn't receive the search parameters.

The behaviour is extremely odd.

If it is any consolation the Evernote Search+ workflow I created for Alfred 2.0 (which I will be extending to do so much more when I get the time) does seem to function correctly - so presumably it is actually something that has changed in Alfred and how it handles AppleScript.

If I can find the time I will investigate this issue in Alfred 1 a little further, but I have a feeling there may be no resolution (except perhaps an Alfred upgrade - which I can see would not be ideal).

Apologies.

Stephen.

March 14, 2013 | Registered CommenterStephen Millard

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>