想要在Safari的新选项卡中打开用户生成的URL
Want to open user-generated URL in new tab of Safari
我刚刚开始使用applescriptt,我想制作一个提示用户输入URL的应用程序。之后,应用程序在Safari的新选项卡中打开给定的URL。这就是我所拥有的,但它不起作用。
tell me
activate
set s to display dialog "Which website do you want to open?" default answer "https://www."
end tell
tell application "System Events"
tell application "Safari" to activate
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
tell application "Safari"
set URL of document 1 to "text returned of s"
end tell
通过将"s的文本返回"括在引号中,您将其作为一个文本字符串,而不是您想要使用的记录属性-删除引号将使其工作。不过,您不必编写用户界面的脚本来制作选项卡,该命令在Safari的脚本字典中,例如:
tell me to activate
set s to text returned of (display dialog "Which website do you want to open?" default answer "https://www.")
tell application "Safari"
activate
tell window 1
set current tab to (make new tab)
set URL of current tab to s
end tell
end tell
相关文章:
- 为什么是FB.注销用户功能不会重定向到我告诉它的 URL
- 将URL字符串${userid}替换为javascript对象中的实际用户id
- 对auth.logout的Facebook事件订阅仅选择性地将用户重定向到url
- 检查用户是否正在访问纯根url
- "“用户友好”;vimeo嵌入,从url获取嵌入代码
- 嵌入iframe URL以在wordpress中包含当前用户id
- 当用户在选择框中选择选项时,使用window.location.href重定向用户只会更改导航器中URL的最后一位
- 在相对于用户当前 URL 路径的不同路径中设置 Cookie
- 将特定于用户的 URL 列表与当前 URL 进行比较
- 从github url中查找用户、repo和路径
- 如何在不重定向用户的情况下更改地址栏URL(不使用历史API?)
- 添加/到URL的末尾将用户带到随机页面,并在其他页面上剥离图像
- URL中用户@的几个请求导致“;违反政策通知;来自Google AdSense
- 根据条件(Angularjs)允许用户访问URL
- 如何获得用户'的国家/地区,并转发到URL
- 如果用户更改了url并且呈现了错误的视图
- Chrome webRequest只侦听用户输入的URL
- 当用户将哈希添加到URL时,重新加载浏览器
- 如何识别用户在评论框中输入的URL
- 当用户按下回车键时,URL将附加一个问号