3

I want to start a Kantu web macro from the command line on Mac. Essentially this is as simple as opening the Chrome or Firefox browser with a local HTML page (which contains the macro code). All works fine on Windows. But on macOS, when I use

mac:~ open 'file:////Users/fabrice/Kantu/demoautofill.html?direct=1&close=1&savelog=demotestlog.txt'

Chrome starts, and the file URL gets opened, but the '?direct=1&close=1&savelog=demotestlog.txt' GET parameter part is lost.

So the question is: How to launch a local html file with GET parameters?

I found this post: https://stackoverflow.com/questions/7710803/open-a-local-html-file-with-url-params-through-applescript which uses AppleScript as a workaround, but it is for Safari, I need Chrome. Plus I would like to avoid using AppleScript, if possible.

1 Answer 1

4

open just handles files, it doesn't know about GET parameters. So the AppleScript approach is probably the way to go here:

osascript -e 'tell application "Google Chrome" to 
    open location "file:///Users/YOU/path/to.html?foo=bar"'
1
  • @cjk I have my default browser set to Safari, nevertheless the above snippet opens the page in Chrome.
    – nohillside
    Sep 21, 2018 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .