Open a local html file with url params through applescript

时光怂恿深爱的人放手 提交于 2019-12-11 08:47:47

问题


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


回答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.



来源:https://stackoverflow.com/questions/7710803/open-a-local-html-file-with-url-params-through-applescript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!