macosterminalapplescriptosx-lionopenurl

Open a local html file with url params through applescript


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


Solution

  • 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.