Jump to content
Ever Better: Refreshing the Evernote Brand Read more... ×
  • 0
DTLow

Scripting on a Mac (Applescript)

Idea

Instead of hijacking other discussions, I am using this discussion to discuss general scripting on a Mac

5aabe5fad2569_ScreenShot2018-03-16at08_41_01.png.afceefd741509c8e191f29cd6c41f1f8.png

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 app5aabe7bdc6837_ScreenShot2018-03-16at08_48_58.png.60683c848be872fe1bdff563e4ad7c95.png

 

Table of Contents

  1. Storage and Menu for accessing scripts
  2. Script: Identify the Note OD File Folder
  • Like 1

Share this post


Link to post

8 replies to this idea

Recommended Posts

  • 1

Two points about the storage and access of Applescripts.5aab78258ccd5_ScreenShot2018-03-16at00_49_45.thumb.png.10509ddb69ff81b4f1c00638cb209b0f.png.a905a79d06a4547e34494e8cbae34573.png.0472805c3f3cae1f81e8619ef13f184a.png

I show a menu of scripts in my top menu bar.

  1. I store the Evernote scripts in folder /Users/<user>/Library/Scripts/Applications/Evernote
  2. I turned on the menu in Script Editor > Preferences.
    5aab780d1e86c_ScreenShot2018-03-16at00_47_42.png.38e7e0e95982a05d77ac2229cd3d0dfc.png.3a056a613a3efab020cb23482db15ca4.png

Share this post


Link to post
  • 0

Script - Identify OS folder the note contents are stored in.5aad69753c843_ScreenShot2018-03-17at12_11_55.png.b2983c9c684c5301b436bc5f11150fbf.png

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.sqllite
The contents of each note are stored in <some folder> and includes:

  • file content.enml
  • attachments5aabeaa332e1f_ScreenShot2018-03-16at09_02_16.png.335a74946ca446621042c56c5760dd8d.png
  • other files (snippet, card image, ...)

 

The script I use to identify <some folder> is below
Evernote_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

5ab3034a91d7f_ScreenShot2018-03-21at18_13_00.png.cf917e358f20cffe3ba61689ffab7108.png

 

Share this post


Link to post
  • 0
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

Share this post


Link to post
  • 0

Script: Import from a CSV file

 

  • Like 1

Share this post


Link to post
  • 0

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
5ab3fb13262bc_ScreenShot2018-03-22at11_50_37.png.be96a8cd16de5ab91f2007b022a979b1.png

 

I use app Lingon to simplify the setup

5ab3fa6381469_ScreenShot2018-03-22at11_45_58.png.764d89b65aa7b4fd24b2373831515397.png

 

Share this post


Link to post
  • 0

Script: Boilerplate code for processing notes5abd4cd86635c_ScreenShot2018-03-29at13_27_24.png.8f6a5f6885fb2994f2432d4e81310140.png

The example shows procesing for

  1. Selected Notes; 
  2. Notes meeting a search query

Share this post


Link to post
  • 0
On 3/16/2018 at 9:20 AM, DTLow said:

Two points about the storage and access of Applescripts.5aab78258ccd5_ScreenShot2018-03-16at00_49_45.thumb.png.10509ddb69ff81b4f1c00638cb209b0f.png.a905a79d06a4547e34494e8cbae34573.png.0472805c3f3cae1f81e8619ef13f184a.png

I show a menu of scripts in my top menu bar.

  1. I store the Evernote scripts in folder /Users/<user>/Library/Scripts/Applications/Evernote
  2. I turned on the menu in Script Editor > Preferences.
    5aab780d1e86c_ScreenShot2018-03-16at00_47_42.png.38e7e0e95982a05d77ac2229cd3d0dfc.png.3a056a613a3efab020cb23482db15ca4.png

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. 

Share this post


Link to post
  • 0
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.5aedd4999fc1d_ScreenShot2018-05-05at08_57_08.png.9506c6527541ea0df6f5f4592ffc28fc.png
If you're working in Evernote, you see the Evernote scripts.

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×