I found this: Using Applescript to export list of URLs based on tags?, which was a great resource. The original script (from Veritrope) is a little old, but worked great for exporting Evernote note titles. I thought it would be relatively easy to modify this script to get JUST the tags in my notebooks into CSV. But since I'm very much an amateur at scripting, and self-taught at that, I couldn't make it work.
Can anyone point me in the right direction? My ultimate aim is to do some tag maintenance, because I now have so many tags that they're not very helpful any more. So I'd just like a list of tags - does NOT have to be associated to the notes. One column of data.
Thanks, stackies.
Here is an AppleScript program that will do what you wish to do:
tell application "Evernote"
set tagList to {}
set allNotebooks to every notebook
repeat with currentNotebook in allNotebooks
set allNotes to every note in currentNotebook
repeat with currentNote in allNotes
set noteTags to (the tags of currentNote)
repeat with currentTag in noteTags
if tagList does not contain name of currentTag then
set the end of tagList to name of currentTag
end if
end repeat
end repeat
end repeat
end tell
set filePath to (path to desktop as text) & "Evernote Tags.csv"
set output to ""
repeat with currentTag in tagList
set output to output & currentTag & ", "
end repeat
set theResult to writeTo(filePath, output, text, false)
if not theResult then display dialog "There was an error writing the data!"
on writeTo(targetFile, theData, dataType, apendData)
-- targetFile is the path to the file you want to write
-- theData is the data you want in the file.
-- dataType is the data type of theData and it can be text, list, record etc.
-- apendData is true to append theData to the end of the current contents of the file or false to overwrite it
try
set targetFile to targetFile as text
set openFile to open for access file targetFile with write permission
if apendData is false then set eof of openFile to 0
write theData to openFile starting at eof as dataType
close access openFile
return true
on error
try
close access file targetFile
end try
return false
end try
end writeTo