eyesuk Posted November 20, 2020 Posted November 20, 2020 (edited) Hello everyone. Long time lurker, first time poster 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 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 November 20, 2020 by eyesuk more info
deanishe Posted November 20, 2020 Posted November 20, 2020 (edited) 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 November 20, 2020 by deanishe eyesuk 1
eyesuk Posted November 20, 2020 Author Posted November 20, 2020 Is this a new requirement? I as able to execute my scripts before upgrading to Big Sur
deanishe Posted November 20, 2020 Posted November 20, 2020 I don’t know why it worked before Big Sur. Perhaps the way open handles invalid URLs has changed.
Andrew Posted November 21, 2020 Posted November 21, 2020 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" eyesuk 1
eyesuk Posted November 21, 2020 Author Posted November 21, 2020 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! 👍🏾👍🏾
eyesuk Posted November 21, 2020 Author Posted November 21, 2020 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 👍🏽👍🏽
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now