AppleScript to Export a List of Titles for Notes In Evernote

Tags: , , ,

Change Log:

  • 1.00 (May 2, 2009) INITIAL RELEASE OF SCRIPT

Okay all you Applescript Ninjas — here’s the code… Dive in, check it out, and tell me how to make it better in the comment thread below!

[code lang="applescript"]
(*

http://veritrope.com

Evernote Note List Exporter
Version 1.0
May 2, 2009

Project Status, Latest Updates, and Comments Collected at:

http://veritrope.com/tips/evernote-note-list-export

Installation: Just double-click on the script!

FastScripts Installation (Optional, but recommended):
--Download and Install FastScripts from http://www.red-sweater.com/fastscripts/index.html
--Copy script or an Alias to ~/Library/Scripts/Applications/Evernote
--Set up your keyboard shortcut

CHANGELOG:

1.00	INITIAL RELEASE
*)

(*MAIN PROGRAM *)
--EVERNOTE NOTEBOOK SELECTION SUBROUTINE
tell application "Evernote"
	activate
	set listOfNotebooks to {} (*PREPARE TO GET EVERNOTE'S LIST OF NOTEBOOKS *)
	(*GET THE NOTEBOOK LIST *)
	set EVNotebooks to every notebook
	repeat with currentNotebook in EVNotebooks
		set currentNotebookName to (the name of currentNotebook)
		copy currentNotebookName to the end of listOfNotebooks
	end repeat

	(*SORT THE LIST *)
	set Folders_sorted to my simple_sort(listOfNotebooks)

	(*USER SELECTION FROM NOTEBOOK LIST *)
	set SelNotebook to choose from list of Folders_sorted with title "Select Evernote Notebook" with prompt ¬
		"Current Evernote Notebooks" OK button name "OK"
	set EVnotebook to item 1 of SelNotebook
	set listofNotes to {} (*PREPARE TO GET EVERNOTE'S LIST OF NOTES *)
	set allNotes to every note in notebook EVnotebook
	repeat with currentNote in allNotes
		set currentNoteName to (the title of currentNote)
		copy currentNoteName to the end of listofNotes
	end repeat

	(*SORT THE LIST *)
	set Notes_sorted to my simple_sort(listofNotes)
	set SelNote to ¬
		choose from list of Notes_sorted with title ¬
			"List of Notes" OK button name "Export List" cancel button name "Close Window" with empty selection allowed

	if (SelNote is not false) then (*EXPORT LIST OPTION *)
		tell application "System Events"
			-- convert list to text
			set old_delim to AppleScript's text item delimiters
			set AppleScript's text item delimiters to return
			set Notes_sorted to Notes_sorted as text
			set AppleScript's text item delimiters to old_delim
			set ExportList to "Current List of Notes for " & EVnotebook & ":" & return & (current date) & return & return & Notes_sorted as Unicode text
			set fn to choose file name with prompt "Name this file" default name "Note List for Notebook Named " & EVnotebook & ¬
				".txt" default location (path to desktop folder)
			set fid to open for access fn with write permission
			write ExportList to fid
			close access fid
		end tell
	else
		set EVnotebook to item 1 of SelNotebook
	end if

end tell

(* SUBROUTINES *)

--SORT SUBROUTINE
on simple_sort(my_list)
	set the index_list to {}
	set the sorted_list to {}
	repeat (the number of items in my_list) times
		set the low_item to ""
		repeat with i from 1 to (number of items in my_list)
			if i is not in the index_list then
				set this_item to item i of my_list as text
				if the low_item is "" then
					set the low_item to this_item
					set the low_item_index to i
				else if this_item comes before the low_item then
					set the low_item to this_item
					set the low_item_index to i
				end if
			end if
		end repeat
		set the end of sorted_list to the low_item
		set the end of the index_list to the low_item_index
	end repeat
	return the sorted_list
end simple_sort
[/code]

DOWNLOAD THE SCRIPT FILE


Did this script help you out? Please make a donation!

Found a bug in the script?

Click Here To Submit Your Bug Report!

Interested in what other scripts are available for Evernote?

Click here to see the latest list!

AppleScript to Export a List of Titles for Notes In Evernote

Pages: 1 2

2 Comments / Jump to comment form

2 Responses to “AppleScript to Export a List of Titles for Notes In Evernote”

  1. Janieangus Janieangus says:

    Omigod, thank you so so sooooo much for doing this, Justin. It works. It’s perfect. I cannot thank you enough. Thank you. Thank you.

    You should extend this into an iPhone app (I dont have an iPhone yet but will next iteration) because this script would be a perfect app for a consultant, or two/three person creative office, who has one person back at the shop who needs to locate a doc. Also perfect for people who useonline assistants.

    Libin says he is going to amend Evernote so that working groups can have access to certain notebooks (instead of the whole world) and this is a quick easy way to locate what you need. He said this on FastCompany last year here:
    http://www.fastcompany.tv/video/a-really-useful-way-take-notes

    Again, I cannot thank you enough! — Janie

    • Justin Justin says:

      Glad you liked it! May it facilitate good research / writing for years to come! (but, hey, no pressure…) ;)

      I think the current iPhone app already does the note listing but, as you rightly point out, adding “working groups” into the mix would be a killer feature. As it stands, the door to your shared notebooks are wide open; Access control would change Evernote from your “personal digital filing cabinet” into a Basecamp/Wiki-esque Information repository for your peeps. With proper access control, we could be exporting these lists as HTML and making those titles clickable!

      Also on my personal list would be the ability to create “aliased versions” — one of my clients likes to share *selected* info from her “TRAVEL” notebook with friends and the only way to do this inside of Evernote is to move the note itself into a shared notebook. When she’s done, she has to move it back to the local notebook. Aliases (or finally allowing people to make “nested folders” , it seems to me, would make this much easier. Que sera sera…

rss Subscribe to Comments RSS Feed


Trackbacks/Pingbacks

  1. Links to Evernote Applescripts and Accessories-- Updated Regularly! | Veritrope

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>