My macro starts with the action, “Activate Bean” (though if I change it to another app, I get the same behavior). If I run the macro from the status bar menu, all’s well. However, if I run it from bash, with: open 'kmtrigger://macro=SaveAndCloseTab’
the application just flashes active momentarily, but immediately de-activates. My intention is to feed the app several simulated keystrokes, yet it only stays active for long enough to accept the first one (cmd-S). Of course I can work around that by activating the app before each keystroke - rather ugly.
Another side-effect of the macro is that, after sending a second keystroke (cmd-W), the Alfred popup window activates - because a double-tap on the cmd key is his hotkey. That happens whether I run the macro from bash or the status bar menu. Sure, I could change Alfred’s hotkey, but that probably only postpones the conflict.
Any suggestions re: how to get around these issues will be most appreciated.
Sure. My favorite note-taking app, Circus Ponies Notebook, has gone out of business. I’ve been through this before, when I moved to the Mac long before there was a Mac version of OneNote, and it was painful. Before I settled on CP Notebook, I tried several others. I’m finally fed up with using proprietary formats for my notes. Luckily, CP Notebook can export to rtd & rtfd, and Bean can read those files, and generally seems to be a nice rtf editor. So I’ll be writing a little python app to browse the folder tree where I export all my notes, and it will drive Bean. However, Bean isn’t scriptable, and to get it to behave the way I want, I’ll be using KM macros run from python via a separate bash shell (and also some run normally via KM hotkeys within Bean). Anyway, that’s the plan. I’m still in the early stages of working this all out.
BTW, in case it helps, I’m running KM 7.0.3 on a 27-inch Late 2013 iMac, 24 GB of memory, OS X 10.11.2 (15C50)
I like Bean, but as you mention it isn’t scriptable.
In case you didn’t know the Satimage.osax will read a folder tree recursively.
What you’re doing may (or may not) be more easily done via AppleScript:
set mySourceFolder to alias ((path to home folder as text) & "Dropbox:Public:Developers:")
set myFileList to list files mySourceFolder as alias
I know you said you’re done with proprietary formats, but you might want to consider Evernote. EN Mac has made some really great progress in the last year, and is now on Ver 6.4. I use it many times a day, and life would be much more difficult without it.
The big benefits of Evernote
Of course the huge benefit of Evernote is that it syncs on all of your devices, Macs, PCs, mobile.
If you have sensitive data you don’t want in the Cloud, you can store in Local Notebooks.
Plus it has one of the best web clippers on the market that eliminates most of the noise and has intelligent suggestions for Notebook and tags (works very well).
EN Mac is very scriptable, using AppleScript, JXA, or KM. In fact I have many EN scripts and macros. Using AppleScript/JXA, you could import your CP Notebook notes, and set properties like Created Date and Tags, and, of course, Title. There is a wealth of AppleScripts at Evernote AppleScripts at Veritrope, plus I have posted many scripts and macros myself.
Evernote offers an export to HTML (which contains note properties), so if you should ever decide to switch from Evernote it should be easy to do so.
@ccstone looked in to some of this, and the result seems to be that the system is activating Keyboard Maestro Engine in response to the kmtrigger: URL (just like it would activate Safari for an http: URL or Mail for a mailto: URL). And then when Keyboard Maestro immediately tries to activate another application, it fails (probably because the system isn’t happy that Keyboard Maestro Engine has completely activated yet).
So you have two solutions:
First, add a short pause to the start of your macro, giving the system time to decide that Keyboard Maestro Engine is as activated as it is going to get.
Or second, probably better, trigger the macro via AppleScript instead, ie something like:
tell app "Keyboard Maestro Engine" to do script "SaveAndCloseTab"
or from a bash script:
osascript -e 'tell app "Keyboard Maestro Engine" to do script "SaveAndCloseTab"'