通过applescript打开一个带有url参数的本地html文件

编程入门 行业动态 更新时间:2024-10-08 10:56:18
本文介绍了通过applescript打开一个带有url参数的本地html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我需要一个非常简单的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/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文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 14:09:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/915771.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   文件   applescript   url   html

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!