Printing Applescript:等待到";“打印”;对话框在Acrobat X中关闭

Printing Applescript:等待到";“打印”;对话框在Acrobat X中关闭,printing,dialog,applescript,acrobat,Printing,Dialog,Applescript,Acrobat,在Applescript中有一个完整的noob,请容忍我 在AcrobatX中,我们有一个使用系统事件控制打印对话框的过程;我们可以“点击”打印按钮 现在,我们必须等到文件打印出来。文档打印时,将打开一个对话框,其中包含标题“打印”、进度条和取消按钮。只有当此窗口关闭时,我们才能继续 到目前为止,我还没有成功地等待;Applescript将继续,这会把过程搞砸 我目前拥有的是(注意,这是一个更大脚本的一部分,变量已经定义并且看起来是有效的) Acrobat处于活动状态,并且“打印”对话框处于打开

在Applescript中有一个完整的noob,请容忍我

在AcrobatX中,我们有一个使用系统事件控制打印对话框的过程;我们可以“点击”打印按钮

现在,我们必须等到文件打印出来。文档打印时,将打开一个对话框,其中包含标题“打印”、进度条和取消按钮。只有当此窗口关闭时,我们才能继续

到目前为止,我还没有成功地等待;Applescript将继续,这会把过程搞砸

我目前拥有的是(注意,这是一个更大脚本的一部分,变量已经定义并且看起来是有效的)

Acrobat处于活动状态,并且“打印”对话框处于打开状态:

tell application "System Events"
   tell process "Acrobat"
      -- now we set all the options in the Print dialog, 
      -- which is in the window Print
      click button "OK" of window "Print
   end tell
end tell

delay 5
-- this gives Acrobat time to get printing and to open that print dialog window

repeat while exists window "Print"
   delay 1
end repeat

close active doc saving no
我还试图将代码放入超时状态,但没有机会

现在,我被卡住了,但我确信这是一个愚蠢的初学者的错误

另一个注意事项:我无法使用UIElementInspector获取此“打印”窗口的名称


非常感谢您的建议。

您的代码是否包含在您尚未在此处报告的
告诉应用程序
块中?
如果将重复循环移动到
告诉流程
块中,它应该可以工作:

tell application "System Events"
    tell process "Acrobat"
        -- now we set all the options in the Print dialog, 
        -- which is in the window Print
        click button "OK" of window "Print"
        delay 5
        -- this gives Acrobat time to get printing and to open that print dialog window
        repeat while exists window "Print"
            delay 1
        end repeat  
    end tell
end tell

close active doc saving no

非常感谢。是的,代码块在一个告诉应用程序“Adobe Acrobat Pro”块中。但是我知道它应该放在哪里,我会尝试它。它花了很长时间,但现在似乎起作用了。谢谢你的帮助。