【问题标题】:Applescript a Variable folder location for use on multiple desktopsApplescript 用于多个桌面的可变文件夹位置
【发布时间】:2014-06-24 19:19:09
【问题描述】:

(我是一个真正的新手)我能够通过从其他帖子中挑选一些内容来创建一个苹果脚本。此脚本使用 acrobat pro 11 引擎从文件夹中批量打印 PDF,并在完成后将它们移动到单独的文件夹中......虽然该脚本在固定桌面路径的一台计算机上运行良好。它必须针对我们使用的每台不同的计算机进行修改。有没有办法在变量位置编写监视文件夹的脚本?

property myFolder : "HD:Users:User:desktop:Print:"

set myfiles to list folder myFolder without invisibles

repeat with myfile in myfiles

    set mycurrentfile to ((myFolder as string) & (myfile as string)) as string
    batchprint(mycurrentfile)

end repeat

on batchprint(mycurrentfile)

    tell application "Adobe Acrobat Pro"
        activate -- bring up acrobat
        open alias mycurrentfile -- acrobat opens that new file    
        tell application "System Events"
            tell process "Acrobat"
                click menu item "Print..." of menu 1 of menu bar item "File" of menu bar 1
                click button "Print" of window "Print"
                tell application "System Events"
                    tell process "Acrobat"
                        click menu item "Close" of menu 1 of menu bar item "File" of menu bar 1
                    end tell
                end tell
            end tell
        end tell
    end tell

    tell application "Finder" -- to move the printed file out 
        set x to (("HD:Users:User:desktop:Printed PDFs") as text)
        if alias x exists then
            beep
        else
            make new folder at the desktop with properties {name:"Printed PDFs"}
        end if
        move alias mycurrentfile to folder "Printed PDFs"
end tell


end batchprint

【问题讨论】:

    标签: pdf applescript acrobat


    【解决方案1】:

    在 AppleScript 中,您可以使用 path to Desktop Folder 引用当前用户的桌面文件夹
    例如:

    set myFolder to (path to Desktop Folder as text) & "Print:"
    

    【讨论】:

    • 效果很好!...谢谢。你能给我一些关于如何在创建第二个文件夹“printed PDFs”的脚本的第二部分中格式化它的指导
    • 将 x 设置为(桌面文件夹的路径为文本)&“打印的 PDF”应该可以工作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-09
    • 1970-01-01
    • 1970-01-01
    • 2012-09-26
    • 2020-09-06
    • 1970-01-01
    • 2011-03-28
    相关资源
    最近更新 更多