我正在尝试使用我拥有的打印插件(称为“PDF Redux”)打印为 PDF。 我有一个脚本,但我无法打开 PDF 菜单并选择正确的插件。
这是我的代码:
tell application "System Events"
tell process "Numbers"
set frontmost to true
keystroke "p" using {option down, command down}
delay 2
click menu item "PDF Redux" of menu button "PDF" of sheet 1 of window 1
end tell
end tell
卡在对话框中找不到PDF菜单。
任何帮助都会很棒。谢谢。
使用菜单项之前,必须打开菜单。我没有这个特定的插件,所以我将使用“...as pdf”。相应修改。我在打印表中包含了相应的方法,但您的
keystroke
也是一种有效的方法。
tell application "System Events"
tell process "Numbers"
set frontmost to true
-- open print sheet
set mf to menu "File" of menu bar 1
perform action "AXPress" of mf
delay 0.1
perform action "AXPress" of menu item "Print Without Preview…" of mf
delay 0.1
-- pdf menu
perform action "AXPress" of menu button "PDF" of sheet 1 of window 1
delay 0.1
perform action "AXPress" of menu item "Save as PDF…" of menu "PDF" of menu button "PDF" of sheet 1 of window 1
end tell
end tell