本文介绍了通过applescript打开一个带有url参数的本地html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个非常简单的applescript 的帮助.我需要它使用 url 参数在 mac 上打开本地 URL.
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
我找不到使用参数打开网页的方法,它总是只打开 .html.
I can't find a way to get the webpage to open with the parameters, it always just opens the .html.
有人可以帮忙吗?谢谢
推荐答案
您可能想要使用可编写脚本的 Safari:
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
open
命令是一个通用函数,旨在用任何程序打开任何文件.它只会查找文件位置并忽略字符串的其余部分.
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.
这篇关于通过applescript打开一个带有url参数的本地html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!