Sample Script: Take Quick Note with NVAlt

I often find myself on the phone and need to take a quick note. Despite having OmniFocus, DevonThink Pro, plus a myriad of other note taking options, I still find it really hard to just take a quick note when I'm talking to somebody. I'm trying to concentrate on the conversation, which leads to my mind going in circles about "which app to use?", "what's that keyboard shortcut?", etc. Basically I spin my wheels.

I tried using the DevonThink capture for a while, but that meant the note was stuck on my Mac.

So I've decided to run with NVAlt as a capture tool which I have set up to save each note to Dropbox, and also have set to sync with Simplenote. This way, I can use NVAlt directly, but DevonThink also indexes the Dropbox folder so I can search within that program. Dropbox sync means that other computers get the notes. Finally, the Simplenote sync means I can access everything on iOS quickly and easily as well.

So where does Keyboard Maestro step in? It solves the 'brain spinning' problem. I've mapped a keyboard shortcut of ^⌥⌘-V to invoke NVAlt, fill a unique date-time stamp (down to seconds to avoid ambiguity if two notes are taken in the same minute), add a tag, then put me into the note field ready to type.

I love that this macro will launch or just activate NVAlt so it doesn't matter whether it's already open or not.

Here is the image of my Keyboard Maestro script - I hope it might help others.

2 Likes

Looks interesting canion, I love nvALT. Would appreciate you posting the Keyboard Maestro macro for this.

Sorry, of course!

Attached is the macro file.

Take NVAlt Note.kmmacros (4.3 KB)

Thanks for that, I’ll try it out.

Hey Andrew,

You can make that a bit more organic. nvAlt's AppleScript dictionary is very rudimentary, but it's easy to create a new note.

Since I'm already doing the heavy-lifting with AppleScript I created the date there as well, but you can just as easily create the date in KM, save it to a variable, and call the variable from the AppleScript.

-Chris


Take NVAlt Note.kmmacros (4.1 KB)


It’s interesting how similar things can be achieved in such different ways. I don’t know how to write AppleScript so I would never have come up with this solution.

While I haven’t tinkered with your solution, I did notice that it doesn’t create ‘scratchx’ as a tag but just as regular text - but that could be amended pretty easily with a couple of other KM commands to move the focus around before inserting that text.

Hey Andrew,

Ah. I missed that ‘scratchx’ was supposed to be a tag. I don’t think tags can be created with AppleScript, but I’ll double-check.

-Chris

Hey Andrew,

I was right. You can't make tags in nvALT with AppleScript, but you can get a bit more sophisticated using nvALT's URL-scheme.

The macro makes a new note with title and tags ( pun intended :).

You can also add body-text, although a space allows for none.

Theoretically it should be unnecessary to do any of the activating actions. The URL-scheme should just work. Unfortunately I've found on my 10.9.5 system that if nvALT is not already running the open-URL scheme alone will launch the app and fail to create the note - hence the extra activation steps in KM.

Actually I should have been able to write this as one line of code in an Execute Shell Script Action, but the upside is that this format allows for much easier modification of the macro.

In any case this method is much more robust than simply driving the UI.

-Chris


nvALT { Create New Note }.kmmacros (6.3 KB)


2 Likes

Chris, this is brilliant.

If my attempt was a caveman’s wheel, yours is a Ferrari.

Thank you very much for your work in putting this together - it certainly trumps what I was doing, and as you say, is more robust with direct code instructions rather that GUI interactions.

I think this will become my go-to script now. I hope it also helps others just as much.

Thanks for producing this version Chris.

Very helpful to see how you constructed it.