google-chrome - 如何使用applescript在系统打印对话框中点击回车?

标签 google-chrome printing applescript osx-snow-leopard

如果它们适合某种 URL 模式(例如不是给定的一组 URL),我想自动打印 chrome 窗口(没有对话框)。

你可以使用苹果脚本吗?有人可以分享一个例子吗? (我没有 mac,所以我无法真正尝试自己)

最佳答案

set i to 1
tell application "Google Chrome"
    activate
    tell window 1
        repeat with t in tabs
            --if title of t starts with "Example" then
            if {"http://example.com/", "http://aa.com/"} does not contain URL of t then
                set active tab index to i
                tell t to print
                delay 1
                tell application "System Events"
                    click button "Print" of window 1 of process "Chrome"
                    --keystroke return
                end tell
            end if
            set i to i + 1
        end repeat
    end tell
end tell

关于google-chrome - 如何使用applescript在系统打印对话框中点击回车?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18212296/

相关文章:

javascript - 是否可以使用 Google-Chrome-Frame 来节省开发时间/金钱,使应用程序适用于 IE?

javascript - 使用 Javascript 在新选项卡中打开 PDF

python - 缺少 str.format() 行为的类型

applescript - 用applescript检测电池百分比

macos - 苹果脚本/Photoshop : Create new layer with image

python - 如何在 Applescript 中运行 python 脚本?

javascript - 更改事件窗口 (chrome.tabs)

html - 更改 HTML 中的换行符

SwiftUI 打印 View

html - 是否可以打印一个 html 页面,并在页面底部粘上一些东西?