Best way to decode an lzstring in KM

Hi all,

I often find that I need to pass fairly complex strings back and forth between Keyboard Maestro and other apps, sometimes with additional processing along the way, using the kmtrigger:// protocol. Since handling quoting in these cases gets complicated, I thought the easiest way to handle it would be to use lzstring to encode the string via compressToEncodedURIComponent at the source and then decode the received %TriggerValue% in KM.

Only… I’m not sure how to do this easily on the KM side. Does KM support local JavaScript libraries, so I can load the lzstring source and then execute JavaScript inside KM? Or does KM provide native support for lzstring decoding/encoding?

Many thanks in advance,

J

Keyboard Maestro supports the Execute a JavaScript For Automation action, so that might be an option.

Do you actually need the compression of lz-string, or just the encoding?

If it's the latter then, being a bit old-school, I'd stick with base64 encoding -- available everywhere, and KM even has a built-in encode/decode "Filter" for it.

2 Likes