Question

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.

Was it helpful?

Solution

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"'
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top