InDesign tip : #33

this post may become a bit of a hodge-podge of a couple of different things, but the main message for today is …

if you have not already ‘upgraded’ to InDesign CC
— DON’T DO IT.

the CC version of InDesign is proving to be a real dog — it sporadically suffers from serious time lags for even the most mundane tasks (eg. selecting text) and is clunky in a bunch of other ways (the UI is simply grotesque — quite windows-like — click to enlarge) :
dialogs comparison between CS6 and CC

we’ve already looked at solving one speed issue that’s been with us since CS4 — the live preflight ‘feature’ — way back in InDesign tip : #09.

upgrading your operating system to OS X 10.9 does help the CC time lag issue significantly, but does not completely resolve the problem. so, you need a couple of other workarounds to help speed things up. these are NOT optimum solutions because they take away some handy functionality which many of us have come to rely upon — but they will help to save you from punching yourself in your own head.

with CC, the speed issue seems to become noticeable once you’ve imported a bunch of high res images (anything more than about half a dozen appears to unsettle the poor blossom). so here are two things to change to get things rolling again (somewhat).

the Pages panel generally looks something like this (screen grabs have been taken from CS6, but most versions are similar) :
pages panel with thumbnails

click on the little icon in the top right corner and you’ll get a dropdown menu — select Panel Options … :
pages panel dropdown

then you can uncheck the thumbnails checkbox :
pages panel options dialog

and all you get is blank page previews :
pages panel without thumbnails

then do the same with the Links panel :
links panel with thumbnails

links panel dropdown

links panel options dialog

links panel without thumbnails

while you’re in the links panel options dialog, you may want to have a bit of a look at the other things you can display in the columns (top section of links panel) and the link info (bottom section). you may find there’s stuff here which is specific for your workflow :
links panel with additional rows
the columns of the links panel can be resized (click and drag the little black line between column headings) and rearranged (click and drag the column heading itself).

you may even find it helpful to set up different versions of the links panel for different workspaces (see tip #08 if you have not yet discovered the benefits of workspaces). for example, some people find it handy to have a basic setup (similar to above) for standard work, but a more extensive set of choices for a separate prepress workspace :
links panel extended

as mentioned, this is not an ideal workaround, but if you’re stuck with InDesign CC and you find the time-lag issue excruciating, then give this a go, at least until Adobe get their act together and restore InDesign to its former glory.

macgrunt icon

Advertisements

InDesign tip : #32

it’s amazing the stuff you’ll find sometimes just by poking around in a program. it seems that if you hold the command key while selecting InDesign > about InDesign you’ll get this panel :
InDesign Component Information Panel

it contains all kinds of gobbledegook — the top section of the panel relates to the InDesign application, the bottom section is about the current document.

no doubt this stuff is useful to professionals who know what’s what, but the bit that’s probably most informative to us amateurs is the document history in the bottom left corner. if you scroll down in that panel you find a blow-by-blow rundown of what’s happened to the document since it was first created in InDesign :
Indesign Document History 01
this one shows a document that was originally converted from a QuarkXpress file back in 2009, has been ‘saved as’ several times, and went through a conversion this morning when it was opened on a different machine in a different version of InDesign.

the listed dates may well help you track down earlier versions of a document but it’s particularly good at letting you know when a file might be getting a little tired (before it finally falls over and refuses to budge).

there are two ways to quickly build a fresh version of a failing file. the first way is the ‘authorised’ technique : save or export your file to the idml format, then open and save. the advantage of this method is that you get an exact duplicate of the old file (with ALL styles, swatches, etc.). the new document history will look something like this :
Indesign Document History 02

but way back in tip #05 we looked at a different method. it basically involves moving pages to a new document :
Move Pages dialog

this is a superior method in several respects : it’s faster, especially as documents get bigger (‘converting’ an idml file can often take some time) ; it also strips out all unused styles, swatches, master pages, etc. so you basically end up with a cleaner file. and the new document history will look something like this :
Indesign Document History 03

have a look and add a comment if you find another cool use for the Adobe InDesign Component Information panel.

macgrunt icon

Photoshop action : flexagon

christmas is a good time for doing stuff with the kids and we’ve been playing around with a few paper toys.

flexagons are groovy little things but they’re a real bugger to set out the artwork for. so here’s a photoshop template and action to do the difficult bits. if you don’t know what a flexagon is, check out this demo from dutchpapergirl, who also shows how to score, fold and glue the finished product.

the blank template looks like this :
screen grab of blank template

just place your artwork in a single layer behind the 3 hexagonal windows. the artwork layer needs to be ‘flattened’ — if it is just graphics with a transparent background, the action won’t work properly :
screen grab of loaded template

then ensure your artwork layer is selected in the layers panel and run the action to rearrange the various bits :
screen grab of finished layout

be aware that only the front faces of the flexagon display your original artwork :
screen grab of front faces

you get a different result if you flip the flexagon over :
screen grab of reverse faces

those funky snowflakes are based on artwork created by the talented chris spooner, who can be forgiven for drawing 8-ray snowflakes because he’s offering the vectors for free download.

you can download the photoshop template and action here.

and if you like mucking about with paper toys like the flexagon, you should also check out the crazy paper thing.

macgrunt icon

InDesign scripting : lesson 34

ok, here’s the last lesson (for now) on exporting each page of an InDesign file as a separate pdf using applescript. lesson 32 showed a basic solution and lesson 33 expanded it to allow for more naming options. this lesson will look at how to generate the pdf filenames from information saved in the InDesign file itself. this solution was prompted by comment 39 in this discussion :

I’m using InDesign to manage 200+ pages of tech sheets for a company … The obvious benefit of using InDesign and having all the tech sheets in a single file is because then I can edit and update Master Pages and have the changes reflected in all of the tech sheets. The major downside though is that when exporting the PDFs … the file name must be specified manually for each tech sheet.

as always, there are many ways to skin a cat. we’re going to look at two approaches — naming based on the heading text of each page, and naming based on script labels. both solutions rely on setting up the InDesign file in a particular way and both solutions begin with this basic setup (refer to the previous lessons for an explanation of these parts of the script) :

tell application id "com.adobe.InDesign"
  set raster resolution of interactive PDF export preferences to one hundred forty four ppi
  set (export reader spreads of interactive PDF export preferences) to false
  set mgFolder to file path of active document
  set mgDocName to name of active document
end tell

tell application "Finder"
  if (exists folder "the pdfs" of folder mgFolder) is false then
    make folder at mgFolder with properties {name:"the pdfs"}
  end if
end tell

tell application id "com.adobe.InDesign"
  repeat with x in pages of active document
    set mgPageName to name of x
    set page range of interactive PDF export preferences to mgPageName
    
    tell active document

      -- REST OF FUNCTIONALITY WILL GO IN HERE

      set mgFilePath to mgFolder & "the pdfs:" & mgText & ".pdf" as string
      export format interactive PDF to mgFilePath without showing options
    end tell
    
  end repeat
  display dialog "ALL DONE!" buttons {"OK"} default button 1
end tell

here’s a snippet of our InDesign file :
screen grab of tech sheets indesign file

there are a few different approaches you could use to pull out the heading on each page as the filename for each pdf. but the easiest way is to set up the InDesign file so that those heading text frames are on their own layer (for this example we’ve called the layer ‘header layer’). so, each page has only one text frame on the header layer — the heading. here’s the remainder of the code to be plugged into the basic script above :

set mgFrames to (text frames of x whose name of item layer is "header layer")
set mgFrame to item 1 of mgFrames
set mgText to contents of item 1 of mgFrame

the first line makes a list of all the text frames on the page on the header layer (this should be a list with only one item). the second line references the first (and only) item in the list — the heading text frame. and the third line grabs the ‘contents’ of that frame (the heading text) to use as the pdf filename. running that completed script will give you this result :
screen grab of generated pdfs
simple, eh?

the alternative method allows you to specify a filename for each page without that filename actually appearing anywhere on the page — the invisible script label. script labels are awesome and were the key to the functioning of the calendars script. a script label can be assigned to any page item, but for this example we’re going to label the heading text frames.

you open the script label panel under windows > utilities. select the frame you want to label — then just type the new label into the panel. once you’re done, deselect the frame — don’t just go to a different page, the script label won’t stick — and don’t hit ‘return’, as this will become part of the label :
screen grab of script label panel

providing you have only one labelled item on each page, you only need to add one extra line to that original basic script above :

set mgText to get (label of every page item of x whose label is not "")

giving you these pdfs :
screen grab of second set of pdfs

another variation will also add the export date to the pdf filenames — this is a good way to keep track of which version you’re up to. we just need to add two more lines :

set mgDate to do shell script "date '+%d-%m-%y'"

and

set mgText to mgText & "_" & mgDate

so the finished script would look like this :
screen grab of final script to export by script labels

and would create pdfs like this :
screen grab of final dated pdfs

ok, so there we have it — a few variations on the exporting-each-page-as-a-separate-pdf theme. hopefully, from this brief introduction, you can see that there are any number of ways to get the job done with applescript. there’s a solution out there for just about any workflow.

keep grunting.

macgrunt icon

InDesign scripting : lesson 33

lesson 32 started looking at how to export individual pages as separate PDFs. it looks like this topic has become popular … a fellow aussie with a passion for getting the most out of InDesign, with a particular focus on prepress, has also written about this, outlining a few solutions — Breaking up is hard to do…

as colmin8r points out, the script from lesson 32 has no user interface, so you can’t control how files are named. that’s what this lesson is all about — extending the script to give you more options. this is how scripts develop — get the basic functionality working, then expand the script to make it more user-friendly, or adaptable, or whatever.

here’s our base script — this time we’re exporting an interactive PDF, rather than using a print PDF preset — but apart from that, it’s the same as the script from lesson 32 :

tell application id "com.adobe.InDesign"
  set raster resolution of interactive PDF export preferences to one hundred forty four ppi
  set (export reader spreads of interactive PDF export preferences) to false
  set mgFolder to file path of active document
  set mgDocName to name of active document
end tell

tell application "Finder"
  if (exists folder "the pdfs" of folder mgFolder) is false then
    make folder at mgFolder with properties {name:"the pdfs"}
  end if
end tell

tell application id "com.adobe.InDesign"

  -- REST OF FUNCTIONALITY WILL GO IN HERE

  repeat with x from 1 to count pages of active document
    set mgPageName to name of page x of active document
    set page range of interactive PDF export preferences to mgPageName
    set mgFilePath to mgFolder & "the pdfs:" & mgDocName & mgPageName & ".pdf" as string
    tell active document
      export format interactive PDF to mgFilePath without showing options
    end tell
  end repeat
  display dialog "ALL DONE!" buttons {"OK"} default button 1
end tell

we’re going to give the user two options — shortening the existing filename by breaking it at the first space or underscore, and the option to add something else to the filename. the code for the dialog looks like this :

  set mgDialog to make dialog
  tell mgDialog
    tell (make dialog column)
      tell (make dialog row)
        make static text with properties {static label:"Where do you want to break the filename?"}
      end tell
      tell (make dialog row)
        set mgDelimiterButtons to make radiobutton group
        tell mgDelimiterButtons
          make radiobutton control with properties {static label:"first underscore", checked state:true}
          make radiobutton control with properties {static label:"first space"}
          make radiobutton control with properties {static label:"full stop", min width:290}
        end tell
      end tell
      tell (make dialog row)
        make static text with properties {static label:"current filename : " & mgDocName}
      end tell
      tell (make dialog row)
        make static text with properties {static label:" "}
      end tell
      tell (make dialog row)
        make static text with properties {static label:"Enter the text you'd like to append."}
      end tell
      tell (make dialog row)
        set mgSuffixField to make text editbox with properties {edit contents:"(can be blank)", min width:250}
      end tell
    end tell
  end tell
  set mgResult to show mgDialog

… and creates a user interface that looks like this :
screen grab of initial user interface
a couple of things to notice … we’ve also added the option of breaking the filename at the first full stop which, if you’re naming your files correctly, means not shortening the filename at all. the dialog also shows the existing filename (in this case “export separate pages_test_file.indd”) to make it easier for the user to make their selections.

the remainder of the code takes the information from the user interface and constructs a new filename to use when saving the PDFs :

  if mgResult is true then
    set mgDelimiterButton to selected button of mgDelimiterButtons
    if mgDelimiterButton is 0 then
      set mgDelimiter to "_"
    else if mgDelimiterButton is 1 then
      set mgDelimiter to " "
    else if mgDelimiterButton is 2 then
      set mgDelimiter to "."
    end if
    
    set text item delimiters of AppleScript to mgDelimiter
    set mgDocName to text item 1 of mgDocName
    set text item delimiters of AppleScript to ""
    
    set mgSuffix to edit contents of mgSuffixField as string
    if mgSuffix is "(can be blank)" then
      set mgSuffix to ""
    end if
    set mgDocName to (mgDocName & "_" & mgSuffix)
    destroy mgDialog
  else
    error number -128
  end if

two things to note here. we’ve added some error handling just in case the user inadvertently leaves “(can be blank)” in the text field of the user interface — we don’t want that to become part of the filename, so we change it to “” (that is, nothing) instead. also, we’re using an underscore to join the shortened filename and the suffix.

hopefully it’s pretty clear how this filenaming works. as an example — if we start with the filename “export separate pages_test_file.indd”, break it at the first space and add the suffix “concepts”, our resulting PDF filenames will be “export_concepts1.pdf”, “export_concepts2.pdf”, etc.

ok, that’s one way you could do it — but you could also make it more complex again by giving the user the option to break the filename in a different place. of course, more complex options mean more complex code. so this :

  set mgDialog to make dialog with properties {name:"Where do you want to break the filename?"}
  tell mgDialog
    tell (make dialog column)
      set mgPlaceButtons to make radiobutton group
      tell mgPlaceButtons
        make radiobutton control with properties {static label:"first", checked state:true}
        make radiobutton control with properties {static label:"second"}
        make radiobutton control with properties {static label:"third", min width:100}
      end tell
    end tell
    tell (make dialog column)
      set mgDelimiterButtons to make radiobutton group
      tell mgDelimiterButtons
        make radiobutton control with properties {static label:"space", checked state:true}
        make radiobutton control with properties {static label:"underscore"}
        make radiobutton control with properties {static label:"full stop", min width:130}
      end tell
    end tell
    tell (make dialog column)
      tell (make dialog row)
        make static text with properties {static label:"current filename : "}
      end tell
      tell (make dialog row)
        make static text with properties {static label:mgDocName}
      end tell
      tell (make dialog row)
        make static text with properties {static label:" ", min width:300}
      end tell
      tell (make dialog row)
        make static text with properties {static label:"Enter the text you'd like to append."}
      end tell
      tell (make dialog row)
        set mgSuffixField to make text editbox with properties {edit contents:"(can be blank)", min width:250}
      end tell
    end tell
  end tell
  set mgResult to show mgDialog

is what you need to create a user interface that looks like this :
screen grab of revised user interface

and the rest of the code is more complex too. this time we’re using the chosen break character to join the filename to the suffix (rather than forcing it to be an underscore) :

  if mgResult is true then
    set mgPlaceButton to selected button of mgPlaceButtons
    if mgPlaceButton is 0 then
      set mgPlace to "1"
    else if mgPlaceButton is 1 then
      set mgPlace to "2"
    else if mgPlaceButton is 2 then
      set mgPlace to "3"
    end if
    set mgDelimiterButton to selected button of mgDelimiterButtons
    if mgDelimiterButton is 0 then
      set mgDelimiter to " "
    else if mgDelimiterButton is 1 then
      set mgDelimiter to "_"
    else if mgDelimiterButton is 2 then
      set mgDelimiter to "."
    end if
    
    set text item delimiters of AppleScript to mgDelimiter
    try
      set mgDocName to text items 1 thru (mgPlace + 1) of mgDocName
      set mgDocName to text items 1 thru mgPlace of mgDocName
    on error
      display dialog "come on dude — that's not possible" & return & "there are not " & mgPlace & " \"" & mgDelimiter & "\" in the filename" & return & return & "have another go" buttons "sorry"
      error number -128
    end try
    set mgDocName to mgDocName as string
    set text item delimiters of AppleScript to ""
    
    set mgSuffix to edit contents of mgSuffixField as string
    if mgSuffix is "(can be blank)" or mgSuffix is "" then
      set mgSuffix to ""
      set mgDocName to (mgDocName & mgSuffix)
    else
      set mgDocName to (mgDocName & mgDelimiter & mgSuffix)
    end if
    destroy mgDialog
  else
    error number -128
  end if

so this time — if we start with the filename “export separate pages_test_file.indd”, break it at the second space and add the suffix “concepts”, our resulting PDF filenames will be “export separate concepts1.pdf”, “export separate concepts2.pdf”, etc.

notice in the above code we’ve added some error handling to make sure the user’s choices make sense. that is, if they choose to break the filename at the third space, and there are not three spaces in the filename, rather than the script simply failing, they’ll get a message stating why it’s not going to work :
screen grab of error message presented to user

and, of course, you can keep on expanding the script until you have as many different options as suits your needs.

the next lesson will look at a couple of other ways we could approach the naming of these separate page PDFs — automatically generating filenames based on data already existing in the document.

until then, keep grunting.

macgrunt icon