Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alfred Evernote Snippets
============================
Script filter:
var q = "{query}";
var values = Application('Evernote').findNotes("notebook:Snippets " + q);
var ret = '<?xml version="1.0"?><items>';
for (var i=0; i<values.length; i++ ) {
var title = values[i].title();
var val = values[i].htmlContent().replace(/<br\/>/g,'{enter}').replace(/<[^>]*?>/g,"");
var sub = values[i].htmlContent().replace(/\n/g,'').replace(/<[^>]*?>/g,"");
ret += '<item arg="'+val+'"><title>' + title + '</title><subtitle>' + sub + '</subtitle></item>';
}
ret += "</items>";
============================
You will need this to properly handle spaces (script filter has trouble with that)
NSAScript (synchronous)
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
on alfred_script(q)
return replace_chars(q, "{enter} ", "\n")
end alfred_script
@lomafor-zz

This comment has been minimized.

Copy link

@lomafor-zz lomafor-zz commented Feb 10, 2018

love this! thanks for sharing. 100 times better than Alfred's built in one.

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