从AppleScript在谷歌浏览器中打开IP

问题描述:

我一直在试图让苹果在谷歌浏览器和Safari浏览器中使用shell脚本打开ip,但是alack没有成功。到目前为止,我一直在试图打开的命令是这样的:从AppleScript在谷歌浏览器中打开IP

do shell script "open http://" & blockedIP 

当我替补blockedIP一个URL其作品,但是当我尝试使用的IP它只是打开使用默认主页和新选项卡IP在地址栏中。我也尝试了其他一些方法,但每个方法都根本不起作用,或者与此相同。任何人都知道我可以做到这一点?

试试这个。

tell application "Safari" 
    make new document at end of documents 
    set URL of document 1 to "http://" & blockedIP 
end tell 

这不使用shell脚本来完成的工作,它采用直接Safari浏览器AppleScripting(因为它是编写脚本。) 如果你想要做的谷歌浏览器一样,然后使用:

tell application "Google Chrome" 
    make new window with properties {mode:"normal"} 
    set URL of active tab of window 1 to "http://" & blockedIP 
end tell