
No warranty on this, and if it breaks something for you, please don’t hold me responsible. The Day One 2.0 CLI needs to be installed per the instructions in the link, and the Text script needs to be installed in ~/Library/Script Libraries or /Library/Script Libraries as usual. If someone figures that out, I’d appreciate it a pull request or a comment.įinally, the New Item script will go ahead and create an entry by calling a shell script to invoke the Day One 2.0 CLI and then it will parse the response via RegEx to get the UUID using the Text script library. I tried to do both of the above with just AppleScript, but the context menu wouldn’t respond to any actions I threw at it.


(With a little work, I could get it to work on dedicated entry windows, but that’s not a priority for the moment.) It’s the one that gets the context menu to pop up in the first place to do the rest of the UI driving.
#Keyboard maestro make macro with action usig applescript driver#
The ‘Get Address’ AppleScript invokes the Get Address macro, which acts as a UI driver to get to the Copy Entry URL menu item and returns it.īoth of the above rely on a third macro, Trigger Context Menu, that at the moment only works on the main window. The ‘Get Name’ AppleScript invokes the Get Name macro, which acts as a UI driver to get to the JSON export of the entry, opens it in TextEdit (because there’s no copy to clipboard option), reads the contents, finds the first line of the text as the title, closes the TextEdit window (but doesn’t quit it), and returns the name. I’ve implemented Get Name, Get Address, and New Item. It’s not packaged as a Plug-In, just a few KM macros and some script elements. We/one could conceivably provide a Keyboard Maestro Plug In Action to bridge Day One and Hook.
