Jump to content

Archived

This topic is now archived and is closed to further replies.

SCC_Evernote

mac (Archived) Script to display paragraphs containing keywords or tags?

Recommended Posts

Does Evernote have the abiility to scan a collection of notes for a certain text string and display only the lines containing that string rather than a list of all the notes with that string?

 

Evernote has the ability to filter Notes based on tags but I would like the ability to fiter lines / paragraphs within notes using tags or keywords.

 

Some programs such as Circus Ponies Notebook, Things, and Folding Text have similar funtionality but I would like to to use one app rather than many and I think this is Evernote's aspiration, too.

 

I think I use Evernote the way a lot of people use it. I take notes on work projects and store them iin note pages withIn one or more notebooks. Meetings notes are typical example. A single Meeting Note entry contains multiple paragraphs -- some of which I'd like to tag on the fly and later see in a single list.

 

A single note might contain tags I've created for all of my work colleagues. (@Rick, @Scott, @Barbara, etc.) These tags are present in many separate notes.

 

The next time I talk to Rick, I'd like to scan through all of my notes using the @Rick tag and see only the individual paragraphs with his tag, not the entire list of Notes containing that tag and have the ability to edit the tag (or add another tag) to remove it from the next scan.

 

Can Evernote do this now or does anyone know of an Applescript that can do this? 

 

Thanks

 

SCC

 

 

Share this post


Link to post

As Metrodon correctly notes, the Evernote client cannot do anything this specific. But as you suggest, things get more interesting (and possible) with AppleScript. If I'm interpreting your needs correctly, this script ought to get the job done.  

tell application "Evernote"	set LF to ASCII character 10	set theTag to "hack"	set foundNotes to find notes "tag:page"	set plainNotes to ""	repeat with i from 1 to count of foundNotes		set the_HTML to HTML content of (item i of foundNotes)		set plain_Text to do shell script "echo " & quoted form of the_HTML & space & "| textutil  -convert txt  -stdin -stdout"		set plainNotes to plainNotes & plain_Text & LF & "- - - - - - - - - -" & LF & LF	end repeat		set tid to AppleScript's text item delimiters	set AppleScript's text item delimiters to "- - - - - - - - - -"	set notesList to text items of plainNotes	set notesList to items 1 through -2 of notesList	set AppleScript's text item delimiters to tid		set matched_notesList to {}	repeat with i from 1 to count of notesList		if item i of notesList contains theTag then			copy item i of notesList to the end of matched_notesList		end if	end repeat		set tid to AppleScript's text item delimiters	set AppleScript's text item delimiters to LF & LF & LF	if (count of matched_notesList) is greater than 1 then		set final_notesList to {}		repeat with i from 1 to count of matched_notesList			copy item i of matched_notesList to the end of final_notesList		end repeat		set notesText to final_notesList as string		set theParagraphs to paragraphs of notesText		set matched_paragraphs to {}		repeat with i from 1 to count of theParagraphs			if item i of theParagraphs contains theTag then				copy item i of theParagraphs to the end of matched_paragraphs			end if		end repeat		set theResult to matched_paragraphs as string			else		set notesText to matched_notesList as string		set theParagraphs to paragraphs of notesText		set matched_paragraphs to {}		repeat with i from 1 to count of theParagraphs			if item i of theParagraphs contains theTag then				copy item i of theParagraphs to the end of matched_paragraphs			end if		end repeat		set theResult to matched_paragraphs as string	end if		tell application "TextEdit"		activate		set newDoc to make new document with properties {text:theResult}	end tell	set AppleScript's text item delimiters to tidend tell 

Key things to note:

set theTag to "hack"
set foundNotes to find notes "tag:page"

 

Change theTag to whatever the text in the notes is that you want to find the paragraphs of. 

I'm assuming that the notes you want are actually tagged with the tag you want to find in the notes themselves. If they aren't, find some way to find the specific notes you want. Change the text after "tag:" to whatever the tag is that will get you a small number of notes (the more specific the search, the faster the script; and vice versa). You can also use other search syntax. This is just an example. 

 

Also, you need to have an empty TextEdit document open. The paragraphs with your theTag will be printed there. As the script stands (I wrote it hastily), it only prints the text of the paragraphs with your search term. It doesn't highlight that term and it doesn't tell you which specific note that particular paragraph comes from. But you could add that I'm sure. 

 

Hope this helps,

stephen

 

 

 

Share this post


Link to post
Guest
This topic is now closed to further replies.

×
×
  • Create New...