【问题标题】:Open a local html file with url params through applescript通过applescript打开一个带有url参数的本地html文件
【发布时间】:2011-12-04 09:05:03
【问题描述】:

我需要一些关于一个非常简单的 applescript 的帮助。我需要用 url 参数在 mac 上打开本地 URL。

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

do shell script str

我找不到用参数打开网页的方法,它总是只打开 .html。

有人可以帮忙吗?谢谢

【问题讨论】:

    标签: macos terminal applescript osx-lion openurl


    【解决方案1】:

    您可能想要使用可编写脚本的 Safari:

    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 命令是一个通用函数,可以用任何程序打开任何文件。它只会查找文件位置并忽略字符串的其余部分。

    【讨论】:

    • 只打开位置而不创建新窗口试试tell application "Safari" to open location “http://...”
    猜你喜欢
    • 1970-01-01
    • 2015-10-14
    • 1970-01-01
    • 2012-03-20
    • 2017-03-24
    • 2023-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多