Almost there with JS scripts

There seems to be a missing urlDecode stage, (or perhaps a surplus urlEncode) in the evaluation of Hook script code following a \\JavaScript first line.


My apologies for the huge delay in responding, @RobTrew. As I noted on the Tinderbox forum, I needed to get clarity on the status of this myself. We have not put the JavaScript feature to work ourselves yet. None of the scripts we currently provide use it.

So the question is whether we should push forward on it. JavaScript is of course more modern and some ways richer than AppleScript. Plus, supporting JavaScript would save people who haven’t yet learned AppleScript the hassle of learning that strange beast. All: Please feel free to share your opinion on this.

I would like us here at CogSci Apps to take more steps towards supporting JavaScript for Hook integration scripts, when we have more time. But I don’t have a specific time frame to offer for this at this point unfortunately.

This is also relevant to our own intention to make Hook itself scriptable (beyond its integration scripts).

For others who are less familiar with “recent” Mac automation history: Back with Yosemite, Apple signalled an interest in JavaScript–by supporting it for automation. OmniGroup built on that. However, Apple hasn’t done much with it since then (per Introduction to JavaScript for Automation Release Notes).

I think you are nearly there. All that seems to have happened is that a urlDecode step has been accidentally missed out.

JS should certainly be supported:

  1. there are a lot of things that it can do much more straightforwardly and more easily than AppleScript (much easier records, richer libraries, including basics like regular expressions and url encoding/decoding etc).
  2. The centre of the apple’s gravity is shifting inexorably towards iOS, on which there is no AppleScript at all, but plenty of JS
  3. JS is the language of web pages – a more generally useful language than AppleScript for users to learn.
1 Like

I’ll put my vote in for everything to be JavaScript! It is by far easier to write in and I definitely know it better. I try my best to stay away from AppleScript. So, please make JavaScript the preferred script.

Also, it would be nice to have an alternative route to interacting with Hook. Going through system automation is now very slow since Majove. Having a local accessable only tcp port and API would make interacting with Hook much faster.

I have the same issue with TextSoap. My Alfred scripts to run TextSoap scripts on text has gotten slower and slower due to changes in the OS. They are looking into adding a tcp interface as well.

1 Like