Scripting language with KBM

What is the full list of scripting languages that can also access application data? I only know of Apple Script and JXA.

Welcome to the forum.

https://wiki.keyboardmaestro.com/manual/Scripting?s[]=scripting&s[]=language

image

Scripting Languages Supported by Keyboard Maestro:

Keyboard Maestro supports running scripts in these languages directly within actions:

  1. AppleScript
  • Full native support.
  • Great for interacting with macOS apps and automation.
  1. JavaScript for Automation (JXA)
  • JavaScript-based automation alternative to AppleScript.
  • Can interact with macOS apps in a similar way.
  1. Shell Scripts (run via sh, bash, or zsh)
  • Perfect for command-line tools and file manipulation.
  • You can choose your preferred shell.
  1. Perl
  • Run directly via a shell script action.
  1. Python (pre-installed versions)
  • Can run legacy versions like Python 2.7 (still present on some systems).
  • For newer macOS versions, Python may need to be manually installed.
  1. Ruby
  • Available via shell script actions.
  • Useful for text and file processing.
  1. Swift (via command line with swift)
  • Indirect support by running via shell if Xcode tools are installed.

:no_entry_sign: Scripting Languages Not Directly Supported by Keyboard Maestro (but runnable via workarounds):

These languages are not directly supported by dedicated KM actions but can be run using external tools or shell commands if installed:

  1. Node.js (JavaScript runtime outside JXA)
  • Use a shell script to run .js files via node.
  1. PHP
  • Can be run via shell script if installed.
  1. Go (Golang)
  • Can compile and run Go binaries or call Go programs via shell.
  1. Rust
  • Same as Go – you can compile and call executables via shell.
  1. Haskell, Java, C++, etc.
  • Require compilation and execution via terminal or calling a compiled binary.

Use the "Execute a Shell Script" action for any language not natively supported (like Node, PHP, Go, etc.), and specify the full path to the interpreter if needed (e.g., /usr/local/bin/node).

Though not a scripting language other things like RegEx are very useful for processing and getting actions to output what you need inside of Keyboard Maestro.

Shell Scripts

  • You can use Bash, Zsh, or any shell language to manipulate text or run logic using Unix tools like grep, awk, sed, cut, etc.
  • These often act like RegEx tools and are very powerful for parsing strings or files.
  • Example shell command:

bash

CopyEdit

echo "$KMVAR_MyVar" | grep -o '[0-9]\+'

If you haven't already check out Tokens and Variables in Keyboard Maestro.

1 Like