我正在尝试创建一个脚本,将一个文件拖放到其中,automator在Adobe Acrobat中打开它,然后applescript在Acrobat中运行一个操作,将其作为优化的PDF保存到特定文件夹中,然后在预览中打开新文件,并使用石英过滤器来减小PDF的大小。
如果我已经在Acrobat中打开了一个文件,并且只运行脚本,它就会在Acrobat中执行操作,保存文件,然后打开预览(还没有得到进一步的结果)。但是如果我把文件放到drop上,它只会给我一条错误消息。
代码如下:
on run {input, parameters}
tell application "System Events"
tell application process "Acrobat"
tell application "Adobe Acrobat Pro" to activate
-- runs the custom action in Acrobat
click the menu item "SAVE in 0-SEND" of menu 1 of menu item "Action Wizard" of the menu "File" of menu bar 1
end tell
end tell
tell application "System Events"
keystroke return
-- clears the action finished message
end tell
tell application "Adobe Acrobat Pro"
activate
close documents saving no
quit
end tell
-- this doesn't work yet
tell application "Finder"
tell application "Preview"
open input
end tell
end tell
end run发布于 2016-03-18 11:00:39
我会推荐一些类似这样的东西。
on run
set aFile to choose file with prompt "Please select the file to process"
processPDF(aFile)
-- cleanup, quit the application
tell application "Adobe Acrobat Pro" to quit
end run
on open (theFiles)
repeat with aFile in theFiles
processPDF(aFile)
end repeat
-- cleanup, quit the application
tell application "Adobe Acrobat Pro" to quit
end open
on processPDF(theFile)
-- open your file
-- do something with theFile here.
-- close the file
end processPDFhttps://stackoverflow.com/questions/36007924
复制相似问题