Page 1 of 1

Indigo - Keyboard Maestro Variables Syncing

PostPosted: Tue Sep 14, 2021 1:35 pm
by bulldogarf
I'm creating interfaces in Indigo for mobile that optimally will be used to both trigger and monitor processes controlled by Keyboard Maestro and AppleScript. I would like to be able to read/write variables to either system but as of yet, haven't found any methods to do this. It's easy to trigger KM via Python from Indigo but I don't yet know how to do the reverse or possibly sync variables that could be shared between the two.

Can anyone point me in the proper direction for this?

Re: Indigo - Keyboard Maestro Variables Syncing

PostPosted: Tue Sep 14, 2021 3:40 pm
by jay (support)
KM can run python scripts, which in turn can call the Indigo REST API. For instance, I use this to toggle my desk lamp when a function key is pressed:

Code: Select all
#! /usr/bin/python2.7

import requests

url = 'https://MYREFLECTOR/devices/Office%20Lamp?toggle=1&_method=put'
requests.get(url, auth=requests.auth.HTTPDigestAuth('username', 'password'))


You could use the same method I think to get a variable value and return it from the script. KM would then get the value and store it into a KM variable. Likewise, it's probably likely that you can pass a KM variable to a Python script that could update the Indigo variable. I don't know specifically how to do either because I've never tried it, so you'll need to experiment with KM to figure it out.

Note: for this script to work you need to have the requests module installed in your Python environment.