Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Applescript: Packaging and exporting PDFs for multiple files -- need some tweaks

New Here ,
Dec 06, 2013 Dec 06, 2013

I found and tweaked a droplet script that isn't quite working right. I am hoping for some help with getting it to work the way I want. I tried and failed to learn to do this myself. Your help is greatly appreciated!

Here's an example: I drag two files called "filename.indd" and "filename2.indd" onto the droplet. The script I have right now will output the packages and PDFs into the following folder structure:

export folder

     filename folder

          filename.pdf

          filename folder

               filename.indd

               [Package contents]

     filename2 folder

          filename2.pdf

          filename2 folder

               filename2.indd

               [Package contents]

Here's the folder structure I need (using a dialog box or script that intelligently knows that the directory to save in is the same as the files I dragged on to the droplet would be amazing):

dialog box to choose new directory set to baseFolder

or

baseFolder <---- set to the current directory of the files I dragged onto the droplet

     filename folder

          filename.indd

          [Package contents]

          PDF folder             <--------new folder "PDF" created

               filename.pdf

     filename2 folder

          filename2.indd

          [Package contents]

          PDF folder             <--------new folder "PDF" created

               filename2.pdf


Here's a script I found and modified:

------

property baseFolder : (path to desktop as text) & "exports:"

on open mgItems

          repeat with mgThisItem in mgItems

                    tell application id "com.adobe.InDesign"

                              try

  open mgThisItem

                                        set mgDocName to name of active document

                                        set text item delimiters of AppleScript to ".indd"

                                        set mgShortName to text item 1 of mgDocName

                                        set targetFolderPath to my createFolder(mgShortName)

                                        set text item delimiters of AppleScript to ""

                                        set mgPackageFilePath to targetFolderPath & mgShortName as string

                                        set mgProofFilePath to mgPackageFilePath & ".pdf" as string

                                        set properties of PDF export preferences to properties of PDF export preset "[Smallest File Size]"

                                        tell the active document to export format PDF type to mgProofFilePath without showing options

                                        tell the active document to package to mgPackageFilePath with copying fonts, ignore preflight errors, copying profiles, updating graphics, including hidden layers, copying linked graphics and creating report

  close active document saving no

                              on error e

  display dialog e

                              end try

                    end tell

          end repeat

          display dialog "PDFs created and InDesign file packaged"

end open

on createFolder(nameString)

          set macFolderPath to baseFolder & nameString

          do shell script "mkdir -p " & quoted form of POSIX path of macFolderPath

          return macFolderPath & ":"

end createFolder

------

Thanks very much!

TOPICS
Scripting
802
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 09, 2013 Dec 09, 2013
LATEST

...anyone? 😕

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines