For a quick & dirty demo of a simple text editor, I made a screen recording, and “narrated” the demo by typing into the editor itself. KM is the perfect tool for typing the lines of my script into the editor window.
ie, in the demo video, one sees text appear, line by line -
"Welcome to TubeWriter"
"The world's first text editor especially for toothpaste packaging!"
Each line of narration to be entered was a macro in the “narration” palette, where the text was the macro name itself. Those macros all just pointed to a generalized routine which types in the current macro’s name. in special cases, I’d customize them to take other actions in the demo app.
I included some “stage directions” (reminders to self) which had no action.
the ‘Narration Action’ macro’s actions:
- Select All (to replace previous narration)
- get %ExecutingMacro% which gives the name of this step, trim off the “nn)” which I use to order them
- insert that text by typing - the pace that KM makes the text automatically appear is … chefs kiss
- other app - specific stuff
lastly there’s macros for “next narration”, and “reset narration”. Which keep track where I am in the script. So I have one key combo to simply "do the next thing."
Careful - This narration engine has no knowledge of the app it’s narrating. It just pastes over the text of any currently active text field.
a few KM questions / suggestions came up when automating the steps through this group - basically I needed to tell KM, "execute macro x of a group" :
-
would have expected KM to have some method for enumerating macros in a group, surprised not to find it, so “Next Narration” is powered by an applescript.
-
Likewise, no method to execute macros by variable name, if I could get that list.
-
The applescript interface to KM must awkwardly jump between addressing KM and KME. I understand there must be implementation reasons why their functionality is separate, but to the script writer, it feels arbitrary. Variables - which I see and edit in KM App - must come from KM Engine. Listing macros & getting their names: KM. Executing macros: KME…
tell application "Keyboard Maestro Engine"
set nCount to (getvariable "narrationCount") as integer
end tell
tell application "Keyboard Maestro"
set nextmacro to macro nCount of macro group "narration palette"
end tell
set macroname to name of nextmacro
tell application "Keyboard Maestro Engine"
do script macroname
return
end tell
demo narration palette Macros.kmmacros (24.1 KB)