Styled Placeholder Text for InCopy

One of the problems encountered in working with an InCopy workflow is indicating to the editor (or copywriter) the paragraph styles you want used for the text. Yes, you could have an elaborate style book set up which mandates the styling patterns for all situations in a publication. More importantly, the template used to create documents for the publication should be setup to support the paragraph styles and style patterns. If next style properties are set up properly to support style patterns, all that is required is that the first style in the group be identified to effect the styling for all paragraphs in the pattern. For instance, an article could begin with a centered headline followed by a byline, then a first paragraph with a drop style, and finally the body style. For this example, the headline style defines the byline as its next style property; the byline defines the first paragraph style, and so on. I refer to a paragraph style grouping such as this as “chained” styles. To use this style chain, the user only needs to identify the first style (headline). To identify the first paragraph style for style “chains”, a naming convention can be used. The one I use identifies the first style for the chain followed by an underscore and then the name for its next style, as in:


With paragraph styles set up in this manner, the layout artist can provide placeholder text styled using the styling pattern expected.

With placeholder text in place, all the InCopy user needs to do is replace the placeholder text with the actual text. This eliminates all questions as to the styles to use.

The placeholder text also can be of a benefit to the layout artist in that it helps visualize the overall design of the layout. This also provides a bonus should the project design require approval.

On the other hand, having to enter placeholder text for every article in a project can add up to a lot of busy work. To help relieve this burden, a tidy little script can be the answer. The script could present the user with a list of all of the paragraph styles that conform to the style convention established for the first style of the styling “chains”. Additionally the label for each style within the chains can identify the text to be used for the placeholder text.

With the script assigned to a keyboard shortcut, the layout artist simply places the text cursor inside of the first text frame for a story and keys in the keyboard shortcut. The script presents a drop down of style names to choose from. With the style selected, the script repeats through the items in the style chain, adds the placeholder text, and assigns the style.

The outline for the script is as follows:


--variables for defining user dialog
set dlgTitle to "Placeholder Styles"
set dlgPrompt to "Choose placeholder styling"
set allowEmpty to false
--call to handler to get reference to document
set docRef to getDocRef()
--call to handler to get reference to insertion point selection
set insertRef to getInsertionPoint ()
--call to handler to get a list of paragraph style names matching naming convention
set paraStyleList to getChainedStyleList (docRef)
--have user choose the style 
set styleChoice to getListChoice (dlgTitle, dlgPrompt, styleList, allowEmpty)
--get list of ordered style names for chain of styles defined by styleChoice
set chainList to getChainList (docRef, styleChoice)
on error errStr
display alert "Error: " & errStr
end try
--main section of script now that all dependencies have been taken care of
tell application "Adobe InDesign CC"
set storyRef to parent story of insertRef
set beginIndex to index of insertRef
repeat with i from 1 to length of chainList
set parastyleName to item i of chainList
set parastyleRef to paragraph style parastyleName of docRef
tell insertRef to set contents to dText & return
set endIndex to beginIndex + (length of dText)
set textRef to object reference of (text from character beginIndex to character endIndex of storyRef)
set applied paragraph style of textRef to parastyleRef
set beginIndex to endIndex + 1
set insertRef to insertion point beginIndex of storyRef
end repeat
select (item 1 of (parent text frames of insertRef))
end tell
--Add handlers for each of the handler calls above


function main() {
var dlgName = "Placeholder Styles";
var dlgLabel= "PlaceholderDlg";
var allowEmpty = false;
try {
    var docRef = getDocRef();
    var insertRef = getInsertionPoint();
    var styleList = getChainstyleList (docRef)
    var userChoice = customDialog (dlgName,  dlgLabel, styleList)
    var chainList = getChainList(docRef, userChoice)
  } catch (e) {
      alert ("Error: " + e);
    var insertIndex = insertRef.index;
    var storyRef = insertRef.parentStory;
    var beginIndex = insertIndex;
    for (var i =0; i < chainlist.length; parastylename="chainList[i];" 
         insertRef.contents="(dText" + "\r");
         var endIndex=beginIndex + dText.length;
         textRef="storyRef.characters.itemByRange(beginIndex, endIndex);

There are a number of handlers/functions required to make the code listed above to work. To get the download for the script, you will want to visit the AppleScript or ExtendScript pages for this site. And, of course, you could expand on the capability of the script to your heart’s content. For instance, if you had a list of the contributors to your publication, you could add a dropdown to the custom dialog for the user to choose the Byline text when a byline is required.

The amount of work your scripts can save for your users is not just a matter of time, consistency of workflow and accuracy all become a big part of the benefit.