Applescript-won';当用作液滴时不起作用

Applescript-won';当用作液滴时不起作用,applescript,automator,Applescript,Automator,我正在尝试创建一个脚本,作为一个水滴,我将一个文件放入其中,automator在Adobe Acrobat中打开它,然后applescript在Acrobat中运行一个操作,将其作为优化的PDF保存到特定文件夹中,然后在预览中打开该新文件,并使用石英过滤器减小PDF的大小 如果我已经在Acrobat中打开了一个文件,并且只运行脚本,它将在Acrobat中执行操作,保存文件,然后打开预览(没有进一步的内容)。但是如果我把文件放到水滴上,它只会给我一条错误信息 代码如下: on run {input

我正在尝试创建一个脚本,作为一个水滴,我将一个文件放入其中,automator在Adobe Acrobat中打开它,然后applescript在Acrobat中运行一个操作,将其作为优化的PDF保存到特定文件夹中,然后在预览中打开该新文件,并使用石英过滤器减小PDF的大小

如果我已经在Acrobat中打开了一个文件,并且只运行脚本,它将在Acrobat中执行操作,保存文件,然后打开预览(没有进一步的内容)。但是如果我把文件放到水滴上,它只会给我一条错误信息

代码如下:

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

我会推荐一些类似的东西

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 processPDF

水滴必须在打开时执行
处理程序。direct参数传递代表已删除项的别名说明符列表。正确处理液滴的模板: