将活动页面导出为PDF(AppleScript + InDesign)

时间:2014-02-07 14:09:59

标签: applescript adobe-indesign

我有一个AppleScript,可以将InDesign中的活动文档导出到桌面上的PDF文件中。

--this script exports all opened InDesign document as PDFs

set my_destination to (path to desktop) as string

tell application id "com.adobe.InDesign"
activate
--next line collects all current PDF export presets
set my_pdf_export to get the name of every PDF export preset
--next line makes you choose which preset to use for ALL opened InDesign documents
set my_pdf_choice to (choose from list my_pdf_export) as string
--loop starts here
repeat with this_doc in (active document)
    --next line gets the name of the active InDesign document
    set doc_name to get name of this_doc
    --next 3 lines perform the actual PDF export
    tell this_doc
        export format PDF type to my_destination & (characters 1 thru -6 of doc_name) & ".pdf" using my_pdf_choice without showing options
    end tell
end repeat
end tell

脚本在导出前提示输入PDF预设。

我希望脚本只导出活动文档的活动页面。

我尝试了一些事情,例如将“活动文档”替换为活动页面“,但我对AppleScript不太了解。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

看起来您从This Macscripter question获得了代码,代码已经在该脚本中了。您只需设置InDesign page range

PDF Export Preferences即可
tell PDF export preferences
    set page range to "1, 3-5"
end tell

请确保在最后将其设置回来,因为这是一个持久的应用程序设置。

tell PDF export preferences
    set page range to all pages
end tell