Level 5* DTLow 5,106 Posted March 16, 2018 Level 5* Share Posted March 16, 2018 Instead of hijacking other discussions, I am using this discussion to discuss general scripting on a Mac Evernote/Mac has a scripting layer built in to the app. This feature is accessed using AppleScript with the app Script Editor There's documentation at https://dev.evernote.com/doc/articles/applescript.php and the Script Editor displays a dictionary for each app Resources Storage and Menu for accessing scripts Import Folder Script: Identify the Note OS File Folder Script - Append Metadata To Note rContents Script - Email to Evernote Script - Extract Selection to Note Script - Search Titles and Insert Link 1 Link to post
Level 5* Solution DTLow 5,106 Posted March 16, 2018 Author Level 5* Solution Share Posted March 16, 2018 Two points about the storage and access of Applescripts. I show a menu of scripts in my top menu bar. I store the Evernote scripts in folder /Users/<user>/Library/Scripts/Applications/Evernote I turned on the menu in Script Editor > Preferences. Link to post
Level 5* DTLow 5,106 Posted March 16, 2018 Author Level 5* Share Posted March 16, 2018 Script - Identify OS folder the note contents are stored in. On a Mac, each note's content is stored in a separate OS folder. The top level folder can be identified using Option Key Help > Troubleshooting The metadata is stored in database LocalNoteStore.sqlite The contents of each note are stored in <some folder> and includes: file content.enml attachments other files (snippet, card image, ...) The script I use to identify <some folder> is belowEvernote_Note_Folder.scpt Note, the database folder is hardcoded; update this for your own installation Note: For external edits, the data accessed is a copy of the master version maintained on the Evernote servers. After verifying my update, l make a dummy change (like adding a space in the note). This ensures the update gets registered and sync'd to the server Link to post
Level 5* DTLow 5,106 Posted March 16, 2018 Author Level 5* Share Posted March 16, 2018 5 hours ago, michaelbierman said: Yup. Another option is to go to System Preferences > Keyboard > Services and you can set a keyboard shortcut of your own choosing. I made some minor improvements yesterday and uploaded them to github. I actually bought a program Fastscripts that assigns a keyboard shortcut to any script. It works great, but I discovered I can't remember all these shortcuts; so most of the time I refer to a menu 1 Link to post
Level 5* DTLow 5,106 Posted March 22, 2018 Author Level 5* Share Posted March 22, 2018 Script: Import from a CSV file 1 Link to post
Level 5* DTLow 5,106 Posted March 22, 2018 Author Level 5* Share Posted March 22, 2018 For automatic scheduling, I use the Mac LaunchAgents feature to launch scripts at a scheduled time. This includes my morning alarm script, and daily backup script. There's documentat at https://en.wikipedia.org/wiki/Launchd but basically it's a .plist file in folder /Users/david/Library/LaunchAgents I use app Lingon to simplify the setup Link to post
Level 5* DTLow 5,106 Posted March 29, 2018 Author Level 5* Share Posted March 29, 2018 Script: Boilerplate code for processing notes The example shows procesing for Selected Notes; Notes meeting a search query Link to post
Sprintup 1 Posted May 5, 2018 Share Posted May 5, 2018 On 3/16/2018 at 9:20 AM, DTLow said: Two points about the storage and access of Applescripts. I show a menu of scripts in my top menu bar. I store the Evernote scripts in folder /Users/<user>/Library/Scripts/Applications/Evernote I turned on the menu in Script Editor > Preferences. This is awesome! How did you get the Evernote Scripts section to appear on the dropdown of the scripts tool in the top toolbar? Asking for a friend. Link to post
Level 5* DTLow 5,106 Posted May 5, 2018 Author Level 5* Share Posted May 5, 2018 10 minutes ago, Sprintup said: How did you get the Evernote Scripts section to appear on the dropdown of the scripts tool in the top toolbar? The scripts are filed in a separate folder for each application and displayed for whatever application is open. If you're working in Evernote, you see the Evernote scripts. Link to post
Level 5* DTLow 5,106 Posted August 23, 2018 Author Level 5* Share Posted August 23, 2018 Script - Backup Evernote Data The backup uses the export feature with the code trywith timeout of (10 * 60) seconds export theNotes to fileBackup format HTMLend timeoutend try For selection criteria, my daily incremental backups use set theNotes to find notes ("updated:day-1 -updated:day") My weekly full backups are a more complicated; a separate export is required for each notebook set allNotebooks to every notebookrepeat with currentNotebook in allNotebooks set notebookName to (the name of currentNotebook) set theNotes to every note in notebook notebookNameend repeat Link to post
Level 5* DTLow 5,106 Posted September 4, 2018 Author Level 5* Share Posted September 4, 2018 Script - Append Metadata To Note Contents Currently the metadata is not stored with the note contents. On a Mac, the metadata is stored separately in an sqlite database My objective is to have this data always available, so I append a copy to the bottom of each note The script runs nightly for all new/changed notes, or on a one-of basis tell application "Evernote" set theNotes to get selection repeat with theNote in theNotes set thedate to modification date of theNote set newText to "<hr/>"set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">Title: " & title of theNote & "</span></span></div>"set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">Notebook: " & name of notebook of theNote & "</span></span></div>"set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">"set newText to newText & "Updated: ud" & my FormatDate(modification date of theNote)set newText to newText & " Created: cd" & my FormatDate(creation date of theNote)set newText to newText & " Subject: sd" & my FormatDate(subject date of theNote)set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">"set newText to newText & "Reminder: rd" & my FormatDate(reminder time of theNote)set newText to newText & " Completed: xd" & my FormatDate(reminder done time of theNote)|set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">"set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">"set theTags to tags of theNoterepeat with theTag in theTags set theTagName to name of theTag set newText to newText & "Tag: " & theTagName & " "end repeat append theNote html newTextset modification date of theNote to thedate end repeatend tell Link to post
Ben68982 0 Posted September 14, 2018 Share Posted September 14, 2018 Hi! I was wondering if there is a way to have the tag of a note change based on it's reminder time. For example if I create a note with the tag "scheduled" and set the reminder to April 5. I want the tag to change from "scheduled" to "open" on April 5th. Can this easily be done? Link to post
Level 5* DTLow 5,106 Posted October 3, 2018 Author Level 5* Share Posted October 3, 2018 On 9/14/2018 at 12:26 PM, Ben68982 said: Hi! I was wondering if there is a way to have the tag of a note change based on it's reminder time. For example if I create a note with the tag "scheduled" and set the reminder to April 5. I want the tag to change from "scheduled" to "open" on April 5th. Can this easily be done? Sorry to have overlooked the post. Yes, it's easy to use scriting to retrieve the reminder time and assign tags The actual commands are set theReminderTime to reminder time of theNoteassign tag theTag to theNoteunassign tag theTag from theNote >>I want the tag to change from "scheduled" to "open" Instead of tag "scheduled", we can use search reminderOrder:* or ReminderTime:* tag "Open" , we can use search -reminderOrder:* or -ReminderTime:* (negation) I'm a tagger, but I don't want to duplicate the trigger; I use Reminders to identify my tasks, open or scheduled Link to post
esala 0 Posted October 6, 2020 Share Posted October 6, 2020 On 9/5/2018 at 5:07 AM, DTLow said: set thedate to modification date of theNote set newText to "<hr/>"set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">Title: " & title of theNote & "</span></span></div>"set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">Notebook: " & name of notebook of theNote & "</span></span></div>"set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">"set newText to newText & "Updated: ud" & my FormatDate(modification date of theNote)set newText to newText & " Created: cd" & my FormatDate(creation date of theNote)set newText to newText & " Subject: sd" & my FormatDate(subject date of theNote)set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">"set newText to newText & "Reminder: rd" & my FormatDate(reminder time of theNote)set newText to newText & " Completed: xd" & my FormatDate(reminder done time of theNote)|set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">"set newText to newText & "<div><span style=\"color: rgb(4, 51, 255);\"><span style=\"font-size: 12px;\">"set theTags to tags of theNoterepeat with theTag in theTags set theTagName to name of theTag set newText to newText & "Tag: " & theTagName & " "end repeat append theNote html newTextset modification date of theNote to thedate I'm really new to this; I was only able to set up the Evernote import folder thanks to your script (which is so helpful). So I want to know how do I use this script to set append metadata? When I pasted this into Script Editor it says, "Expected “,” or “)” but found class name." Thank you for your time. Link to post
Level 5* DTLow 5,106 Posted October 7, 2020 Author Level 5* Share Posted October 7, 2020 On 10/6/2020 at 2:21 PM, esala said: I'm really new to this; I was only able to set up the Evernote import folder thanks to your script (which is so helpful). So I want to know how do I use this script to set append metadata? When I pasted this into Script Editor it says, "Expected “,” or “)” but found class name." That's a partial script I see "subject date of theNote" so this code should be within a tell application "Evernote" ..... end tell I also see a call to subroutine FormatDate, so that needs to be defined Link to post
Jeff-Prime 0 Posted February 21 Share Posted February 21 The reason this is happening is that - at least as of version 10.8.5 - the Mac EN is not supporting Applescript - if you try to use Script Editor to open the app's dictionary, you'll see it's unavailable (ie greyed out). Don't know if this is on purpose, or someone just forgot to include the appropriate AS Library resource in a recent build. Link to post
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now