1

I need some help with a very simple applescript. I need it to open a local URL on mac with a url parameter.

set str to "open -a 'Firefox' file:///Users/bob/Desktop/someFolder/index.html?val=28"

do shell script str

I can't find a way to get the webpage to open with the parameters, it always just opens the .html.

Can someone help? Thanks

slinky2000
  • 2,663
  • 1
  • 15
  • 12

1 Answers1

1

You may want to use Safari, which is scriptable:

tell application "Safari"
    make new document with properties {URL:"http://stackoverflow.com/questions/7710803/open-a-local-html-file-with-url-params-through-applescript?bob=bob"}
end tell

The open command is a general-purpose function, meant to open any file with any program. It will simply look for file location and ignore the rest of the string.

eykanal
  • 26,437
  • 19
  • 82
  • 113
  • To just open location without creating a new window try `tell application "Safari" to open location “http://...”` – Palimondo Sep 03 '17 at 21:58