CE Certificate to Evernote
CE Certificate to Evernote (version 1.01)
- Released December 13, 2020
Release Announcement]
This AppleScript is written for use with Hazel to parse a serial number from a filename and append it to an Evernote note with the same serial number.
I use this to make sure that when I complete a continuing education course the certificate gets filed in a way that I can find it later. I use a serial number in the body of the Evernote note that I create for taking notes during the course, then save the file with the same serial number in the file name. Use | to offset the serial number in the filename.
This minor update addresses a change in Evernote--Evernote Legacy (v. 7.14) maintains support for AppleScript, while the current version of Evernote (10.X) does not.
Terms of Use
CE Certificate to Evernote by Robert P. Allred, PhD is licensed under a Creative Commons Attribution 4.0 International License
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material for any purpose, even commercially.
This license is acceptable for Free Cultural Works.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Important Links
Current Project Page: https://doctorallred.com/software/index.php?title=CE_Certificate_to_Evernote
System Requirements
This script has been tested with macOS Catalina (macOS 10.15), Evernote Legacy 7.14, and Hazel 4.4.5.
Installation
- Requires macOS
- You must have both Hazel and Evernote Legacyt installed. It DOES NOT work with Evernote 10.X
- Create a Hazel rule to monitor a folder, then choose your action as "run AppleScript" and paste the code below into Hazel's built-in AppleScript editor.
Current Version
Version 1.01 (December 13, 2020)
(*
This version works from a Hazel rule.
Pass serial number from Hazel to AppleScript. Comes from here: https://www.noodlesoft.com/forums/viewtopic.php?t=1770&p=7294
*)
tell application "Finder"
set myHazelTokenDelimiters to "|"
set theListOfCustomTokens to name of theFile -- the serial MUST have letters to works
set AppleScript's text item delimiters to {myHazelTokenDelimiters}
-- Now, the tokens are available in theListOfCustomTokens as items 1,2,3 etc...
set noteSerial to text item 2 of theListOfCustomTokens
-- set newFilename to "CE Certificate " & noteSerial & ".pdf" -- Rename file, not implemented yet
-- set name of theFile to newFilename
set fileURL to POSIX path of theFile
end tell
(*
Based on: https://colterreed.com/how-to-append-to-evernote-notes-with-applescript/
*)
tell application "Evernote Legacy"
set myNotebook to "\"Work Notes\"" -- set which notebook to search here
set searchString to "notebook:" & myNotebook & " " & noteSerial -- create an Evernote query string. See here: https://dev.evernote.com/doc/articles/search_grammar.php#Search_Terms
set matches to find notes searchString -- find note that matches both variables
set myNote to item 1 of matches -- this only works if there is only 1 match
open note window with myNote
-- add some tags (in progress)
--Append to the selected note
tell myNote to append attachment theFile
tell myNote to append text fileURL
end tell
[Download here as Zip archive]
Change requests
- Support for adding additional tags to the Evernote note.
- Rename the file to remove delimiters before attaching to note.
Previous versions
CE Certificate to Evernote (version 1.0)
Full Change Log
- 1.01 (December 13, 2020): Updated script to support "Evernote Legacy" instead of calling Evernote 10.X without AppleScript support.
- 1.00 (May 23, 2020): Initial release of script