Search code examples
pythonkeyboard-maestro

Passing KeyboardMaestro's variable to Python script


I need to create a variable with some values, and give the value to the python script one liner (python -c "...") to process the variable, and get it back into the same or other variables.

How can I do that with Keyboard Maestro?


Solution

  • The variable from KeyboardMaestro can be accessed with os.environ['KMVAR_...']; %Variable% is accessed as os.environ['KMVAR_Variable']. For the output, if you use "Execute text script", you can also control how the output from the Python interpreter would be directed.

    enter image description here