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

时间:2014-10-28 14:34:29

标签: applescript

我编写脚本以使用applescript将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 

怎么了?

1 个答案:

答案 0 :(得分:0)

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

keystroke "p" using command down