KeyScope – Scripting

You can trigger any KeyScope action with a simple AppleScript* command run action <label>, where <label> is the action label, like this:

tell application "KeyScope"
	run action "Solo clear"
end tell

You can also use the action id, like this:

tell application "KeyScope"
        run action id "16F6EE87-FAD4-4524-9270-0C9DD10C26F0"
end tell

The return value is either “success” or a custom message like “UI element not found”

“Copy value” type actions return a copied value.

This is a tiny script that copies selection start and end time in Pro Tools to the clipboard:

tell application "KeyScope"
	set startTC to run action "Copy - Edit selection start"
	set endTC to run action "Copy - Edit selection end"
	set returnString to startTC & " - " & endTC
end tell

There are many ways to use these scripting commands. You can either use them in addition to the action’s keyboard hotkey or not assign a keyboard hotkey and run the action with a script command exclusively.

There is a free plugin for Stream Deck that can run scripts which is called OSA script.

* Being both OSA languages, KeyScope supports not only AppleScript but also JavaScript for Automation (JXA).