Description
Here's a quick bit of Script-fu for all you Evernote users: A user calling him/herself "gatekeeper" (probably a guy, but you can never rule out the possibility of a Sigourney Weaver / Ghostbusters variety of Gatekeeper) posted a message on the Evernote forum asking if there was "a way to generate in to a text file only the urls from all my snaps ?"... I can see how this could be useful in certain circumstances -- especially for those people who use Evernote as a sort of private delicious.com substitute (in other words, as a sort of anti-social bookmarking service). I had published a script here a while back that saved a list of Note Titles as a text file... Could that be easily adapted to do the job here? (Spoiler Alert: Yes, it can.)Teaching An Old Script Some New Tricks
Okay, Gatekeeper -- You'll find some source code and a download link to a compiled script below (saved as a ZIP file)! Like the original AppleScript that it was based upon, this one asks you to pick the Evernote notebook that you want to see the list for and, once selected, a window will open containing a list of URLs from all the notes within that notebook that have anything in the "Source URL" field. You can then cut-and-paste that list or, if you like, save it as a text file to a location of your choosing. Hope you enjoy it... and Viva La AppleScript!The Code
(*
http://veritrope.com
Evernote URL List Exporter
Version 1.1
November 27, 2010
PROJECT PAGE:
http://veritrope.com/tips/save-a-list-of-urls-from-your-evernote-items-as-a-list
CHANGELOG:
1.10 ADDED NOTE TITLE AND URL FIELDS TO EXPORTED TEXT FILE
1.00 INITIAL RELEASE
*)
(*MAIN PROGRAM *)
(*PREPARE A EVERNOTE'S LIST OF NOTEBOOKS *)
tell application "Evernote"
activate
set listOfNotebooks to {}
(*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 note_Records to {}
set allNotes to every note in notebook EVnotebook
repeat with currentNote in allNotes
try
set currentNoteURL to (the source URL of currentNote)
set currentNoteTitle to title of currentNote
if currentNoteURL is not missing value then
copy currentNoteURL to the end of listofNotes
copy {name:currentNoteTitle, URL:currentNoteURL} to the end of note_Records
end if
end try
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 URLs In Notes" OK button name "Export List" cancel button name "Close Window" with empty selection allowed
(*PROCESS RECORDS LIST *)
set record_Text to {}
repeat with note_Record in note_Records
set theCurrentRecord to ("Title: " & name of note_Record & return & "URL: " & URL of note_Record & return & return) as text
copy theCurrentRecord to the end of record_Text
end repeat
(*EXPORT LIST OPTION *)
if (SelNote is not false) then
tell application "System Events"
-- convert list to text FILE
set ExportList to "Current List of URLs in Notes for " & EVnotebook & "-- " & (current date) & return & return & record_Text as Unicode text
set fn to choose file name with prompt "Name this file" default name "URL 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
http://veritrope.com
Evernote URL List Exporter
Version 1.1
November 27, 2010
PROJECT PAGE:
http://veritrope.com/tips/save-a-list-of-urls-from-your-evernote-items-as-a-list
CHANGELOG:
1.10 ADDED NOTE TITLE AND URL FIELDS TO EXPORTED TEXT FILE
1.00 INITIAL RELEASE
*)
(*MAIN PROGRAM *)
(*PREPARE A EVERNOTE'S LIST OF NOTEBOOKS *)
tell application "Evernote"
activate
set listOfNotebooks to {}
(*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 note_Records to {}
set allNotes to every note in notebook EVnotebook
repeat with currentNote in allNotes
try
set currentNoteURL to (the source URL of currentNote)
set currentNoteTitle to title of currentNote
if currentNoteURL is not missing value then
copy currentNoteURL to the end of listofNotes
copy {name:currentNoteTitle, URL:currentNoteURL} to the end of note_Records
end if
end try
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 URLs In Notes" OK button name "Export List" cancel button name "Close Window" with empty selection allowed
(*PROCESS RECORDS LIST *)
set record_Text to {}
repeat with note_Record in note_Records
set theCurrentRecord to ("Title: " & name of note_Record & return & "URL: " & URL of note_Record & return & return) as text
copy theCurrentRecord to the end of record_Text
end repeat
(*EXPORT LIST OPTION *)
if (SelNote is not false) then
tell application "System Events"
-- convert list to text FILE
set ExportList to "Current List of URLs in Notes for " & EVnotebook & "-- " & (current date) & return & return & record_Text as Unicode text
set fn to choose file name with prompt "Name this file" default name "URL 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