Jump to content

Calling a KeyboardMaestro script passing input causing error -- 4.2.2 [1189]


eyesuk

Recommended Posts

Hello everyone. Long time lurker, first time poster :D

I am running into an issue when calling a KM and passing query values with what it appears to be special characters.  I have confirmed that KM accepts all the values, but Alfred errors before KM is reached.

 

I tried to troubleshoot this a bit without any luck, I am calling a KM script that tweets a set of characters.

At the moment when I pass it this input Profits $SNAP @ 41.89 △3.34% it breaks, see errors below:

 

The workflow calls: open "kmtrigger://macro=johnyCinco%20Orig&value={query}"

Input: Profits $SNAP @ 41.89 △3.34%

ERROR: JohnnyCinco Tweet[Run Script] The file /Users/...../kmtrigger:/macro=johnyCinco%20Orig&value=Profits $SNAP @ 41.89 △3.34% does not exist

 

I tried several iterations changing the Escaping options and got similar errors:

.../kmtrigger:/macro=johnyCinco%20Orig&value=Profits\ $SNAP\ @\ 41.89\ △3.34% does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=profits $SNAP @ 41.89 △3.34% does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=Profits$SNAP@41.89△3.34% does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=profits  @ 41.89 △3.34% does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=△3.34% does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=△3.34 does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=Profits\  does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=Profits  does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=△ does not exist.

.../kmtrigger:/macro=johnyCinco%20Orig&value=% does not exist.

 

 

I tried changing all the below options a number of times but nothing seemed to work 

image.png.b2f8877881dc24832afdb0d0b28bfbb6.png

 

What works:

Passing output 'Profits'

Passing output '~'

Passing output '3.34'

Passing output '+3.34'

Passing output '$'

 

 

I hope everyones loved ones are all safe and healthy.

Thanks for your help.

 

Edited by eyesuk
more info
Link to comment
Share on other sites

Use an Open URL element instead of a Run Script.

 

The URLs you're generating aren't valid. You need to %-encode values inserted into URLs (e.g. the correct URL for input Profits $SNAP @ 41.89 △3.34% is kmtrigger://macro=johnyCinco%20Orig&value=Profits%20%24SNAP%20%40%2041.89%20%E2%96%B33.34%25), but Run Script doesn't support %-encoding.

Edited by deanishe
Link to comment
Share on other sites

Big Sur's open command has changed and sometimes does odd things if the URL isn't pre-coded.

 

For example, in Big Sur, if you use:

 

open "tel:+44 123 456"

 

you get the output:

 

The file /Users/<removed>/tel:+44 123 456 does not exist.

 

Prior to Big Sur, you could throw anything at the open command and it would encode and open it, so the tel: url above would have opened Facetime and dialled the number.

 

In Big Sur, you now have to use:

 

open "tel:+44%20123%20456"

 

Link to comment
Share on other sites

22 hours ago, deanishe said:

Use an Open URL element instead of a Run Script.

 

The URLs you're generating aren't valid. You need to %-encode values inserted into URLs (e.g. the correct URL for input Profits $SNAP @ 41.89 △3.34% is kmtrigger://macro=johnyCinco%20Orig&value=Profits%20%24SNAP%20%40%2041.89%20%E2%96%B33.34%25), but Run Script doesn't support %-encoding.

Thanks man I appreciate it! 👍🏾👍🏾

Link to comment
Share on other sites

8 hours ago, Andrew said:

Big Sur's open command has changed and sometimes does odd things if the URL isn't pre-coded.

 

For example, in Big Sur, if you use:

 


open "tel:+44 123 456"

 

you get the output:

 


The file /Users/<removed>/tel:+44 123 456 does not exist.

 

Prior to Big Sur, you could throw anything at the open command and it would encode and open it, so the tel: url above would have opened Facetime and dialled the number.

 

In Big Sur, you now have to use:

 


open "tel:+44%20123%20456"

 

Thanks man 👍🏽👍🏽

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...