通过带有Preview.app的appescription将ppt保存为pdf



我写了一个脚本,用appescript将xls转换为pdf。这是我的代码:

set the_file to (choose file) 
tell application "Preview" 
    activate 
    open the_file 
end tell 
tell application "System Events" 
    tell process "Preview" 
        keystroke "p" with command down 
        tell front window 
            UI elements 
        end tell 
    end tell 
end tell 

当我运行脚本时,中有错误

keystroke "p" with command down 

怎么了?

您需要关键字using而不是关键字with。因此,错误的行应该是:

keystroke "p" using command down

最新更新