I need for perform URL encoding on the input text string in AppleScript. After some searching, I was surprised to find out this was not as trivial as I thought. Shortcuts really spoiled me with those built-in Actions
Thanks, I had no idea this was possible!
I just installed bash to test the idea from the StackOverflow thread (using the open command to perform URL encoding) but all my attempts ended in failure. I guess I’m doing something wrong here.
I come from graphic automation tools such as Shortcuts and started writing scripts very recently. Are there any ready-made command line utilities specifically made for URL encode and decode? I found some for Linux but seemingly none for macOS.
To the extent that open parses URLs, it’s done internally. It doesn’t return an encoded URL that you can use later in your script. This is unrelated to the shell you’re using.
There are different ways to encode URLs, so we have to know what DevonTHINK needs. For example, do slashes and colons have to be encoded?
Also, are you sure need to do any encoding at all? The URLs you get from copying the field at the top of the browser and from right-clicking and copying links from the body of a web page are already encoded.
I haven’t considered this and tbh I don’t know its detailed needs. But fwiw, the input strings are titles of notes, so most if not all the non-alphanumerical characters are spaces and commonly used punctuations.
I do need to encode, because as noted above, I’m encoding note titles.