InDesign scripting : lesson 28

we’ve already looked a fair bit at how to export pdfs from InDesign using applescript. see lessons 08, 09, 10, 11, and 12 plus InDesign scripting : bringing it together. but these scripts have relied on pdf export presets and, as it turns out, there’s a really good reason NOT to use an export preset when creating a pdf.

presets invariably export a ‘print’ pdf, but these often have tiny white lines criscrossing the screen. this is an unfortunate side effect of transparency flattening and is quite off-putting to clients, who incessantly ask “is it going to print like that?”. but if you export an ‘interactive’ pdf, you don’t get the dreaded white criscrossy lines (strange but true — who knows why?).

now, at this stage, you can’t save interactive pdf settings as export presets. but that don’t matter none — cause we got applescript.

this script is a stripped back version of a much larger one — with additional export options and email generation. this post will focus mainly on the syntax for exporting interactive pdfs — so refer back to the posts listed above if any of the other bits are confusing.

the first part of the script generates a dialog like this :

  set mgDialog to make dialog with properties {name:"How you want this exported then?"}
  tell mgDialog
    tell (make dialog column)
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"PDF export setting : ", min width:140}
        end tell
        tell (make dialog column)
          set mgResolutionButtons to make radiobutton group
          tell mgResolutionButtons
            make radiobutton control with properties {static label:"72ppi layout", checked state:true}
            make radiobutton control with properties {static label:"96ppi layout", min width:180}
            make radiobutton control with properties {static label:"144ppi layout"}
          end tell
        end tell
      end tell
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"Document option : ", min width:140}
        end tell
        tell (make dialog column)
          set mgDocumentsButtons to make radiobutton group
          tell mgDocumentsButtons
            make radiobutton control with properties {static label:"active document only", checked state:true}
            make radiobutton control with properties {static label:"all open documents", min width:180}
          end tell
        end tell
      end tell
      
      set mgResult to show mgDialog
      if mgResult is true then
        set mgResolution to selected button of mgResolutionButtons
        set mgDocuments to selected button of mgDocumentsButtons
        destroy mgDialog
      else
        error number -128
      end if
    end tell
  end tell

that gives you a dialog that looks something like this :
screen grab of script dialog

and captures the results into two variables : mgResolution and mgDocuments

it’s important to remember that a radiobutton group returns an integer – starting at 0 – not the label assigned to the selected button. for example, if you select the second option in the top radio button group you will get ‘1’ as the result (not “96ppi layout”)

so, the next thing we need to do is assign variables depending on the choices made in the dialog :

  if mgDocuments is 0 then
    set mgDocList to name of active document as list
  else if mgDocuments is 1 then
    set mgDocList to name of every document
  end if
  if mgResolution is 0 then
    set mgResolution to seventy two ppi
  else if mgResolution is 1 then
    set mgResolution to ninety six ppi
  else if mgResolution is 2 then
    set mgResolution to one hundred forty four ppi
  end if
  
  my mgExportInteractive(mgResolution, mgDocList)

you’ll notice here that when re-specifying the variable mgResolution we don’t use quotation marks (it’s seventy two ppi not “seventy two ppi”). this is because the three options shown above are constants defined by the developers. if you want a different resolution you can use an integer between 72 and 300 (eg. set mgResolution to 200).

that last line passes the two final variables (mgResolution and mgDocList) to the subroutine that does the actual work (mgExportInteractive).

now, it’s not really necessary to use subroutines, but they are a great way to make scripts modular. it makes it easy to cut and paste whole chunks of reusable functionality into a future script (and you WILL do this as you get more and more into scripting).

there are two subroutines in this script, the second one is called from within the first one :

on mgExportInteractive(mgResolution, mgDocList)
  tell application id "com.adobe.InDesign"
    set properties of interactive PDF export preferences to {interactive PDF interactive elements option:include all media, generate thumbnails:true, pdf magnification:fit page, pdf page layout:single page, flip pages:false, PDF JPEG quality:maximum, open in full screen:false, page transition override:from document, PDF raster compression:JPEG compression, include structure:false, page range:all pages, export layers:false, export reader spreads:false, view PDF:false}
    set raster resolution of interactive PDF export preferences to mgResolution
    repeat with i from 1 to (count of mgDocList)
      set active document to (every document whose name is item i of mgDocList)
      my mgProcess()
      tell active document
        export format interactive PDF to mgFilePath without showing options
      end tell
    end repeat
  end tell
end mgExportInteractive

on mgProcess()
  tell application id "com.adobe.InDesign"
    set mgFolder to file path of active document
    set mgDocName to name of active document
    set text item delimiters of AppleScript to {"."}
    set mgDocName to text item 1 of mgDocName
    set text item delimiters of AppleScript to ""
    set mgFilePath to mgFolder & mgDocName & ".pdf" as string
  end tell
end mgProcess

now, if you scroll all the way out to the right, you’ll see an interesting thing. oh, all right, you don’t have to scroll all the way out — I’ll tell you — there’s a piece of code there that says “… export reader spreads:false …”. why is this interesting? because, in CS5 (the version this script was written for), exporting reader spreads in an interactive pdf is the default and there’s no option to change it in the standard export dialog box (this has been rectified by CS6). but you CAN change it through applescript — a rare case of something you can do with applescript which cannot be done with the native program. running a script containing that piece of code will change all future exports as well — so you may want to add another line to your final script to reset it back to the default “true” — it’s up to you.

so, that’s the basic syntax for exporting ‘interactive’ pdfs rather than ‘print’ pdfs. check the dictionary for all the other settings you can adjust through applescript.

to download the complete functioning script, you can go here.

have a good one

macgrunt icon

Advertisements

InDesign scripting : bringing it together

this post is a response to a question from Tom :

I am working towards a compilation of scripts to take customer supplied Indd documents – Drop them on applet or automator – Print 1 laser / create 3 PDF files (different settings) / email the low res proof to CSR. … What I picture in my head is getting the email PDF proof script running the way I want – Put it into automator as part of a larger workflow. Then get the other elements as scripts – put those into the same workflow – ??

two things to note straight up — you don’t need separate scripts and you don’t need automator. but this is a great little example because all we need to do is pull together a bunch of script snippets already scattered around this site. as you read through you’ll see highlighted bits that link back to posts with more details.

let’s go … first things first — we want this to be a droplet (so you can drag and drop files onto the app for processing) so the whole script will be wrapped in an on open handler. and you’ll need to wrap it in a repeat loop so it can handle more than one dropped file at a time. and it would be a good idea to alert the user when the script has finished doing its thing. so the initial bits will look something like this :

on open mgItems
  repeat with mgThisItem in mgItems
    -- rest of script here
  end repeat
  display dialog "some kind of confirmation message here"
end open

then we need InDesign to open and process each file. but we should put this in a try block to ensure the script doesn’t crash if a different file type is dropped on it inadvertently :

on open mgItems
  repeat with mgThisItem in mgItems
    tell application id "com.adobe.InDesign"
      try
        open mgThisItem
        tell active document
          -- do printing and pdf stuff in InDesign
        end tell
        close active document
      on error
        -- decide what kind of error handling you want to include if the file won't open
      end try
    end tell
    -- rest of script for email processing here
  end repeat
  display dialog "some kind of confirmation message here"
end open

the observant will notice that the tell application command is different from previous scripts on this site. this is the way to address any version of InDesign — but be aware that other parts of this script may have terms or syntax that may need to be adjusted for your particular version of InDesign.

ok — next comes the printing bit. if you’re using only one print preset for this workflow you’d use a simple line :

print using "name_of_print_preset" without print dialog

but if you need to change the print preset based on the file specs you’d need something more complex like in InDesign scripting : lesson 24.

exporting pdfs is covered in lessons 08, 09, 10, 11, and 12 and cover a few different ways to approach the problem. three basic things need to be determined : the export preset to be used, the name of the pdf and the location to save it to.

the simplest version of this part of the workflow might look like this (but depends on Tom’s specific needs) :

set mgDocName to name of active document
set text item delimiters of AppleScript to " "
set mgShortName to text item 1 of mgDocName
set text item delimiters of AppleScript to ""
set mgHRFilePath to "path:to:highres:folder:" & mgShortName & "_HR.pdf" as string
set properties of PDF export preferences to properties of PDF export preset "HighRes"
tell active document
  export format PDF type to mgHRFilePath without showing options
end tell
set mgHRDigitalFilePath to "path:to:highresdigital:folder:" & mgShortName & "_HRD.pdf" as string
set properties of PDF export preferences to properties of PDF export preset "HighResDigital"
tell active document
  export format PDF type to mgHRDigitalFilePath without showing options
end tell
set mgProofFilePath to "path:to:proof:folder:" & mgShortName & "_proof.pdf" as string
set properties of PDF export preferences to properties of PDF export preset "Proof"
tell active document
  export format PDF type to mgProofFilePath without showing options
end tell

that’s it for the InDesign bits. now to email that third pdf. first get a reference to the file, then create the message — Tom’s using Entourage (thanks to Ben Waldie at MacTech for the Entourage code) :

tell application "Finder"
  set mgFile to mgProofFilePath as alias
end tell
set mgSubject to "proof of job " & mgShortName as string
tell application "Microsoft Entourage"
   set theRecipients to {{address:{display name:"CSR Name", address:"CSR@tomsplace.com"}, recipient type:to recipient}}
   set theMessage to make new outgoing message with properties {recipient:theRecipients, subject:"mgSubject", content:"here's your proof dude", attachments:mgFile}
   send theMessage
end tell

again, this is pretty much the simplest form this part of the workflow could take. Tom will need to expand it to encompass his particular requirements.

the final basic structure could look something like this :

on open mgItems
  repeat with mgThisItem in mgItems

    tell application id "com.adobe.InDesign"
      try
        open mgThisItem
        tell active document
          print using "name_of_print_preset" without print dialog
        end tell
        set mgDocName to name of active document
        set text item delimiters of AppleScript to " "
        set mgShortName to text item 1 of mgDocName
        set text item delimiters of AppleScript to ""
        set mgHRFilePath to "path:to:highres:folder:" & mgShortName & "_HR.pdf" as string
        set properties of PDF export preferences to properties of PDF export preset "HighRes"
        tell active document
          export format PDF type to mgHRFilePath without showing options
        end tell
        set mgHRDigitalFilePath to "path:to:highresdigital:folder:" & mgShortName & "_HRD.pdf" as string
        set properties of PDF export preferences to properties of PDF export preset "HighResDigital"
        tell active document
          export format PDF type to mgHRDigitalFilePath without showing options
        end tell
        set mgProofFilePath to "path:to:proof:folder:" & mgShortName & "_proof.pdf" as string
        set properties of PDF export preferences to properties of PDF export preset "Proof"
        tell active document
          export format PDF type to mgProofFilePath without showing options
        end tell
        close active document
      on error
        -- decide what kind of error handling you want to include if the file won't open
      end try
    end tell

    tell application "Finder"
      set mgFile to mgProofFilePath as alias
    end tell
    set mgSubject to "proof of job " & mgShortName as string
    tell application "Microsoft Entourage"
      set theRecipients to {{address:{display name:"CSR Name", address:"CSR@tomsplace.com"}, recipient type:to recipient}}
      set theMessage to make new outgoing message with properties {recipient:theRecipients, subject:"mgSubject", content:"here's your proof dude", attachments:mgFile}
      send theMessage
    end tell

  end repeat
  display dialog "some kind of confirmation message here"
end open

of course, this isn’t a definitive solution — it’s simply a demonstration of one possible approach to the problem.

once you’re done compiling the perfect script, save it as an app and drag it onto your sidebar so it’s easily accessible — then start dropping those indd files.

macgrunt icon

InDesign scripting : lesson 22

performing tedious, repetitive tasks — no matter how small — is monkey-work. automating those tasks makes you just that little bit less like a monkey. if you take a moment to think about it, you may find you’re wasting an awful lot of life on mundanities …

… such as creating and emailing proofs for clients. this script will export a pdf, attach it to an email, then add the recipient, subject line and basic message — all with just three double-clicks.

the first part of the script exports the pdf. exporting pdfs was covered way back in scripting lessons 08 thru 12, so refer back to them if you need an explanation of what’s going on here :

tell application "Adobe InDesign CS4"
  activate
  save active document
  set mgPdfPresets to name of every PDF export preset
  set mgPdfPreset to choose from list mgPdfPresets with prompt "How you want these done then?" with title "CHOOSE PDF EXPORT PRESET"
  if mgPdfPreset is false then
    display dialog "WHATEVER!" buttons "get stuffed" giving up after 1
    error number -128
  end if  
  
  set properties of PDF export preferences to properties of PDF export preset (item 1 of mgPdfPreset)
  set page range of PDF export preferences to all pages
  set mgFolder to file path of active document
  
  tell application "Finder"
    if (exists folder "PDF" of folder mgFolder) is false then
      make new folder at mgFolder with properties {name:"PDF"}
    end if
  end tell
  set mgDocName to name of active document
  set OrigDelims to text item delimiters of AppleScript
  set text item delimiters of AppleScript to {"."}
  set mgShortName to text item 1 of mgDocName
  set text item delimiters of AppleScript to OrigDelims
  
  set mgFilePath to mgFolder & "PDF" & ":" & mgShortName & ".pdf" as string
  tell active document
    export format PDF type to mgFilePath without showing options
  end tell
end tell

tell application "Finder"
  set mgFile to mgFilePath as alias
end tell

this uses the choose from list command which will present the user with a dialog listing their available export presets. it’ll look something like this :
screen grab of pdf export selection dialog

just for shits and giggles we’ve added a surly message for any user who dares to cancel that dialog instead of proceeding.

the last part of that script above gets a reference to the pdf as an alias — ready to attach to the email.

the next part of the script sets up the details for the email. this workflow has a small number of possible email recipients (just the four sales reps who deal directly with clients) — you might want to come up with a different solution if your list is longer :

set mgChoice to choose from list {"macGrunt", "macGroan", "macGrumble", "John"} with prompt "Who you want this sent to?"
if mgChoice is false then
  error number -128
end if
set mgChoice to item 1 of mgChoice
if mgChoice is "macGrunt" then
  set mgAddress to "macgrunt@macgrunt.com"
else if mgChoice is "macGroan" then
  set mgAddress to "macgroan@macgrunt.com"
else if mgChoice is "macGrumble" then
  set mgAddress to "macgrumble@macgrunt.com"
else if mgChoice is "John" then
  set mgAddress to "john@macgrunt.com"
end if

set mgContent to "Hi " & mgChoice & return & return & "Here's your groovy proof" & return

first the user is asked to select from another list that might look something like this :
screen grab of email recipient dialog
then, based on that choice, the email address is set. finally verbage for the email content is set.

the last part of the script sets up the actual email and will need to change depending on which email software you are using. for example, this is how you could do it for Mail :

tell application "Mail"
  activate
  set mgMessage to make new outgoing message with properties {visible:true, subject:mgShortName, content:mgContent}
  tell mgMessage    
    make new to recipient with properties {name:mgChoice, address:mgAddress}
    tell content of mgMessage
      make new attachment with properties {file name:mgFile} at after last paragraph
    end tell
  end tell
  save mgMessage
  set visible of mgMessage to true
end tell

you’ll notice that, for this workflow, we’re using the shortened filename as our subject line.

this is how it would go if you needed to do the same thing with Outlook :

tell application "Microsoft Outlook"
  activate
  set mgMessage to make new outgoing message with properties {subject:mgShortName, content:mgContent}
  make new recipient at mgMessage with properties {email address:{name:mgChoice, address:mgAddress}}
  make new attachment at mgMessage with properties {file:mgFile}
  open mgMessage
end tell

you should be able to use these as a starting point — just open the relevant scripting dictionary in script editor to work out the syntax specific to your email software. if it all becomes too hard — google is your friend.

well, that’s it. a relatively small time-saving, but just think how many times you repeat that simple monkey-task every week.

macgrunt icon

InDesign scripting : lesson 12

this is the fifth and final (for now) in a series of lessons on exporting pdfs using applescript. we started this script in lesson 11 which showed how to create an interface to capture some choices from the user. the finished script will export separate pdfs for different page ranges within the one document.

the next portion of the script does three things : it creates a folder in the same location as the InDesign file with the ‘mgSubFolder’ name specified in the first part of the script ; it creates a truncated version of the filename for us to append the page ranges to ; and it tells InDesign the pdf export preset we want to use :

set mgFolder to file path of active document
tell application "Finder"
  if (exists folder mgSubFolder of folder mgFolder) is false then
    make new folder at mgFolder with properties {name:mgSubFolder}
  end if
end tell

set mgDocName to name of active document
set text item delimiters of AppleScript to {"."}
set mgDocName to text item 1 of mgDocName --strips extension from filename
set text item delimiters of AppleScript to {" "}
set mgDocName to (text item 1 of mgDocName & " " & text item 2 of mgDocName)
set text item delimiters of AppleScript to ""

set export reader spreads of PDF export preferences to false
set properties of PDF export preferences to properties of PDF export preset mgExport

that middle section is the place to play around with your own preference for how to name your pdfs. text item delimiters determine which character is used to separate bits of text — and those bits of text are called text items. these three examples should help to demonstrate :

set mgDocName to "54321 This_Is A-Weird File_Name.indd"
set text item delimiters of AppleScript to {"."}
return text items of mgDocName
-- > {"54321 This_Is A-Weird File_Name", "indd"}  - 2 text items
set mgDocName to "54321 This_Is A-Weird File_Name.indd"
set text item delimiters of AppleScript to {"_"}
return text items of mgDocName
-- > {"54321 This", "Is A-Weird File", "Name.indd"} - 3 text items
set mgDocName to "54321 This_Is A-Weird File_Name.indd"
set text item delimiters of AppleScript to {" "}
return text items of mgDocName
-- > {"54321", "This_Is", "A-Weird", "File_Name.indd"} - 4 text items

so, you need to change that middle section to suit your current filenaming protocol. ALWAYS set your text item delimiters back to the default “” before moving on.

ok, the last bit of the script repeats through the list of page ranges we captured in ‘mgPageList’ :

repeat with mgExportPage in mgPageList
  set page range of PDF export preferences to mgExportPage
  set mgFilePath to mgFolder & mgSubFolder & ":" & mgDocName & "_" & mgExportPage & ".pdf" as string
  if mgSpreads is "true" then
    if mgExportPage contains "-" then
      set export reader spreads of PDF export preferences to true
    end if
  end if
  tell active document
    export format PDF type to mgFilePath without showing options
  end tell
  set export reader spreads of PDF export preferences to false
end repeat

well, that’s it. it’s a good idea to add another dialog box at the end, just to let you know when all the exporting has completed. once you put all those bits together you should have a script which looks something like this (click to enlarge) :
screen grab of final Export As Separate PDFs script

or, if you’re feeling particularly lazy, you can get the completed script

macgrunt icon

InDesign scripting : lesson 11

this is the fourth in a series of lessons on exporting pdfs using applescript. lessons 08 and 09 showed how to export all open InDesign files at once. this next script will create separate pdfs for different page ranges within the one document. this is really handy in a publishing environment where you often export just portions of a file, rather than the whole document.

as with the first script, this one begins by creating an interface to get user input. InDesign offers scripters an excellent range of UI elements — this dialog has two sets of radio buttons and a text edit field. copy this into your script editor (found in applications > applescript) :

tell application "Adobe InDesign CS4"
  activate
  set mgDialog to make dialog with properties {name:"This script exports specified pages as separate PDFs"}
  tell mgDialog
    tell (make dialog column)
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"Export preset to use :    "}
        end tell
        tell (make dialog column)
          set mgExportButtons to make radiobutton group
          tell mgExportButtons
            make radiobutton control with properties {static label:"Press Quality", checked state:true}
            make radiobutton control with properties {static label:"Inhouse Printing"}
            make radiobutton control with properties {static label:"Screen Resolution"}
          end tell
        end tell
      end tell
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"Page range to export :    "}
        end tell
        tell (make dialog column)
          set mgPageRange to make text editbox with properties {edit contents:""}
        end tell
      end tell
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"Export spreads as :    "}
        end tell
        tell (make dialog column)
          set mgSpreadsButtons to make radiobutton group
          tell mgSpreadsButtons
            make radiobutton control with properties {static label:"Separate pages", checked state:true}
            make radiobutton control with properties {static label:"Spreads"}
          end tell
        end tell
      end tell
    end tell
  end tell
  set mgResult to show mgDialog
end tell

that script gives you a dialog something like this :
screen grab of user interface created by script

well, that’s OK, but it’s a bit fugly. to get things lining up, you need to specify some minimum widths. the static text elements should all be the same width, and the interactive elements should all be the same width :

tell application "Adobe InDesign CS4"
  activate
  set mgDialog to make dialog with properties {name:"This script exports specified pages as separate PDFs"}
  tell mgDialog
    tell (make dialog column)
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"Export preset to use :    ", min width:170}
        end tell
        tell (make dialog column)
          set mgExportButtons to make radiobutton group
          tell mgExportButtons
            make radiobutton control with properties {static label:"Press Quality", checked state:true}
            make radiobutton control with properties {static label:"Inhouse Printing", min width:150}
            make radiobutton control with properties {static label:"Screen Resolution"}
          end tell
        end tell
      end tell
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"Page range to export :    ", min width:170}
        end tell
        tell (make dialog column)
          set mgPageRange to make text editbox with properties {edit contents:"", min width:150}
        end tell
      end tell
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"Export spreads as :    ", min width:170}
        end tell
        tell (make dialog column)
          set mgSpreadsButtons to make radiobutton group
          tell mgSpreadsButtons
            make radiobutton control with properties {static label:"Separate pages", checked state:true}
            make radiobutton control with properties {static label:"Spreads", min width:150}
          end tell
        end tell
      end tell
      make static text with properties {static label:" "}
      make static text with properties {static label:"Commas = separate PDFs (eg. 1, 2, 3, 4 gives four PDFs)"}
      make static text with properties {static label:"Hyphens = the same PDF (eg. 1, 2-3, 4 gives three PDFs)"}
    end tell
  end tell
  set mgResult to show mgDialog
end tell

notice how the static text elements align right by default — you just have to get used to it because there’s no way around it. this version of the dialog also has a couple of hints for the user at the bottom :
screen grab of revised user interface

aawww — nicer. ok, now to capture the results of the dialog. you’ll remember from lesson 08 that you have to check that the ‘OK’ button is clicked, that radio buttons are numbered from 0 and that this is where you must use the exact name of your pdf export presets (case sensitive). this portion of the script comes immediately before the last end tell :

  if mgResult is true then
    set mgExport to selected button of mgExportButtons
    set mgPageList to edit contents of mgPageRange as string
    set mgSpreads to selected button of mgSpreadsButtons
    destroy mgDialog
  else
    destroy mgDialog
    error number -128
  end if
  
  if mgExport is 0 then
    set mgExport to "Offset Printing"
    set mgSubFolder to "Prepress Files"
  else if mgExport is 1 then
    set mgExport to "Xerox Printing"
    set mgSubFolder to "Xerox PDFs"
  else if mgExport is 2 then
    set mgExport to "[Smallest File Size]"
    set mgSubFolder to "Low Res PDFs"
  end if
  if mgSpreads is 1 then
    set mgSpreads to "true"
  end if

  set text item delimiters of AppleScript to " "
  set mgPageList to text items of mgPageList
  set text item delimiters of AppleScript to {""}
  set mgPageList to mgPageList as string
  set text item delimiters of AppleScript to ","
  set mgPageList to text items of mgPageList
  set text item delimiters of AppleScript to ""

now, you’ll understand most of that because you studied lesson 08 so well. here’s an explanation of that last bit where we process mgPageList through three coercions… imagine your user is a keyboard hack — a really shocking typist who enters this in the text editbox :

"1, 2-3, 14 -15, 26 - 27,   38,   49  "

you could just let them suffer and have the script fail, or you could take pity on them and add some processing to make everything right. the first coercion above gives you this monstrosity :

{"1,", "2-3,", "14", "-15,", "26", "-", "27,", "", "", "38,", "", "", "49", "", ""}

but don’t panic, because the second coercion renders this :

"1,2-3,14-15,26-27,38,49"

and the third coercion makes it all ok. a nice neat list, each item of which will be its own pdf. this example will export six pdfs :

{"1", "2-3", "14-15", "26-27", "38", "49"}

well, that’s it for now. we’ll complete this script in the next lesson. the finished script will add the page ranges to a truncated version of the filename — so exporting from “54321 ThisFile Name.indd” gives a pdf named, for example, “54321 ThisFile_2-3.pdf”. you’ll learn how flexible that process is — so you can tailor the renaming to your specific needs.

until then, keep grunting.

go to lesson 12

macgrunt icon