如何使用AppleScrip在系统打印对话框中按回车键? [英] How to use applescript to hit enter on system printing dialog box?

查看:7
本文介绍了如何使用AppleScrip在系统打印对话框中按回车键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望自动打印Chrome窗口(无对话框),如果它们符合某种URL模式(例如,不属于给定的URL集)。

你能用苹果的脚本实现这一点吗?有谁能分享一个例子吗?(我没有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

这篇关于如何使用AppleScrip在系统打印对话框中按回车键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆