KeyScope – Scripting


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

You can trigger any KeyScope action with a simple AppleScript* command in the form of 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

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

soundflix