Description
Reader JanieAngus asked if I could expand the Apple Mail-Evernote AppleScript to get list of docs in each notebook. She wrote:I want a list of what's in my notebooks by title. One notebook is legal. Need to give that list to someone. Don't know how. Another notebook for research. SO voluminous -- don't know what's there. Want list by my side as I write. (Cuz other stuff in DevonTHINK)Well, Janie -- I hacked up the Mail Script for you and I think it'll do what you want! When you run it, you'll see a list of notebooks to choose from (à la the Original Script). Select the notebook you want to see the list for and a window will open containing the titles of all the notes within that notebook. But that doesn't really help you give that list to anyone else, does it? So I added in a new section to the script which allows you to save that list to a text file. The script saves the notebook name into the default file name and also the date/time the list was exported to the beginning of the text file itself.
Options to Install and Use
- Just open the script and run it!;
- FastScripts from Red Sweater will let you trigger the script from the keyboard! Here's how you set it up: Copy the script or an Alias to ~/Library/Scripts/Applications/Evernote. Set up your keyboard shortcut in the FastScripts Preference menu
Change Log:
- 1.01 (August 22, 2011) BUGFIX FOR LION
- 1.00 (May 2, 2009) INITIAL RELEASE OF SCRIPT
The Code
(*
http://veritrope.com
Evernote Note List Exporter
Version 1.01
August 22, 2011
Project Status, Latest Updates, and Comments Collected at:
http://veritrope.com/code/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.01 BUGFIX FOR LION
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 *)
-- 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)
tell application "System Events"
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
http://veritrope.com
Evernote Note List Exporter
Version 1.01
August 22, 2011
Project Status, Latest Updates, and Comments Collected at:
http://veritrope.com/code/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.01 BUGFIX FOR LION
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 *)
-- 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)
tell application "System Events"
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
Hi,
since I have a lot of notes in my Evernote notebooks, could you please adjust the script “Evernote – List of Note Titles Exporter” to just make a list of note titles with only a special tag.
That would be great for me – and as I think many others.
Thank you in advance,
Ricklef
Think this could be a good one for a separate script… I’ll keep in mind!
Small point, but you can speed this script up somewhat by removing the repeat block at the beginning. If someone has a really large Evernote the difference will be noticeable. You can get all notebook names more directly via:
tell application “Evernote”
set listOfNotebooks to name of every notebook
end tell
Hi,
It would be awesome if this script could be adapted to limit export to ‘reminder’ notes only and include date info in a chronological order.
Im sure many will find this usefull if managing projects and reporting on tasks with evernote.
Let me know your thoughts.