推出Chrome的Applescript(具体细节)

Jon*_*lby 10 macos applescript google-chrome

我真的很难创建一些在osx上启动浏览器窗口(chrome)的方法,其中包括窗口大小,没有标签等特定内容.传统上我通过IE浏览器使用vb脚本,这是一个非常简单的练习,但我'我会第一个承认,当涉及到mac时,我非常挣扎.

所以这是我的愿望清单.

我需要能够打开一个窗口(理想情况下是chrome,但除了safari之外的任何其他浏览器),没有状态栏,没有给定URL的地址栏和特定的窗口大小.我使用do javaScript在safari中管理了一些东西,并使用执行javascript和'window.open'尝试使用chrome,但是这种情况不断失败......

救命!

Lri*_*Lri 23

我没有找到任何隐藏Chrome中工具栏的方法,但尝试使用以下脚本:

tell application "Google Chrome"
    open location "http://example.com"
    tell window 1 to enter presentation mode
end tell
Run Code Online (Sandbox Code Playgroud)
tell application "Google Chrome"
    tell (make new window)
        set URL of active tab to "http://example.com"
        set bounds to {0, 22, 1200, 900}
    end tell
    activate
end tell
Run Code Online (Sandbox Code Playgroud)
tell application "Safari"
    make new document with properties {URL:"http://example.com"}
    tell window 1
        set bounds to {0, 22, 1200, 900}
    end tell
    activate
end tell
tell application "System Events" to tell process "Safari"
    tell menu "View" of menu bar 1
        if exists menu item "Hide Toolbar" then click menu item "Hide Toolbar"
        if exists menu item "Hide Status Bar" then click menu item "Hide Status Bar"
        if exists menu item "Hide Tab Bar" then click menu item "Hide Tab Bar"
        if exists menu item "Hide Bookmarks Bar" then click menu item "Hide Bookmarks Bar"
    end tell
end tell
Run Code Online (Sandbox Code Playgroud)