Your prescription for increased productivity and profitability
Of all the reasons to use InCopy for editing copy for InDesign, being able to monitor story depth is number one. Because InCopy and InDesign share the same text composition engine, your workflow can know how long a story will be.
Layout-based or Assignment-based workflow. When the story is started in InDesign and then assigned to InCopy, the Copyfit Progress gauge in the toolbar shows the editor when the length of the story has been achieved (or overset as in the screen capture below).
Edit-first workflow. When the story starts in InCopy, the Copyfit Progress toolbar in Layout view is used to determine story length information. Story depth is displayed after D: in the toolbar. The other fields are: line count (L:), word count: (W:), character count (C:).
To automate copy fitting in the Edit-first workflow the following is suggested.
Start with an InCopy template set to the column width required. (You may have several templates from which the user can choose). The following code has the user select the template from files found in the Templates folder defined by the variable templatePath. After the template is chosen, the script uses the template to open a new unnamed document in InCopy. The sample code assumes the path to this folder is inside InCopy application’s folder. You will need to change this to the location of your choice.
tell application "Adobe InCopy CC 2014" set appPath to (file path as string) set templatePath to (appPath & "Templates") set templateChosen to my getTemplate(templatePath) set documentRef to open templateChosen end tell on getTemplate(templatePath) set thePrompt to "Select template for story" set templateChosen to choose file with prompt thePrompt default location (templatePath as alias) return templateChosen end getTemplate
Using a custom dialog for the script, you could expand the above to include input fields for the user to determine the proposed story text area depth, or to modify the text area width as needed. For this the following properties for document preferences are exposed for AppleScript:
In addition to defining the default column width and text area depth, the template will need to include paragraph and character styles that correspond with the styles for the final document.
To make life easier for the user, the template may also start with dummy text styled with a default paragraph style that has its next paragraph property set. The screen shot following illustrates how the dummy text can be used to show the user how the default paragraph styles will be chained.
By adding the following code to the script, the dummy text is selected when the document is created.
--insert before end tell in code above tell documentRef set storyRef to object reference of paragraph 1 of story 1 select storyRef existing selection add to end tell activate
When the user begins to type, the dummy text is replaced by the text entered. With each hard return, the paragraph style changes using the next style property for the style. This happens until the assigned style has its own style as its next style property. At this point, the text entered could be styled as follows when viewed in Layout view.
If the user does not want to use the default styling, the paragraph styles can be chosen manually from Incopy’s Paragraph Styles panel. Alternatively, you could provide a script to present the user with a list of suggested style groups. If the script is assigned a keyboard shortcut, a quick keystroke combination will give the user access to this list. When a styling choice is made, the following will change the style of the first paragraph.
tell application "Adobe InCopy CC 2014" tell document 1 set storyRef to object reference of paragraph 1 of story 1 select storyRef existing selection add to set styleGroup to paragraph style group 1 set styleList to name of every paragraph style of styleGroup set styleName to my getSelection(styleList) if styleName is not missing value then set applied paragraph style of paragraph 1 of story 1 to paragraph style styleName end if end tell activate end tell on getSelection(styleList) set thePrompt to "Choose styling from list" set styleChosen to choose from list styleList with prompt thePrompt without multiple selections allowed if class of styleChosen is list then set myStyle to item 1 of styleChosen else set myStyle to missing value end if return myStyle end getSelection
To enable copy fitting, you will also want your InCopy templates to be set up so that Copyfit Info is enabled (Window > Copyfit Info). In Layout mode (command + L), the Copyfit toolbar displays the number of lines, words, characters, and, most importantly, the current depth for the story (see screen capture above).
For an edit-first workflow, the story depth can be critical for the person doing page layout. The InCopy side of the workflow can convey this information using one of several methods:
Either of these methods can be performed manually or automated using a script. This can be done when the story is saved.
A script can facilitate saving a story in a number of ways:
For this last task, a small problem arises when using a script to determine the story depth. The depth of the story that displays in the Copyfit toolbar is not exposed, as is, for scripting. The closest to this is the baseline value of the last line for the story. For this reason, you might decide to have the user enter the number displayed in the Copyfit Progress toolbar as part of entering the name as in the script below since this figure will be slightly more accurate.
--define folder for saving InCopy file set parentPath to (path to home folder from user domain) as string set saveFolder to parentPath & "Creative Cloud Files:InCopyFiles" --get name for story try set storyStr to getName ("Enter story name with story length") on error errStr activate display alert errStr return end try tell application "Adobe InCopy CC 2014" set storyRef to a reference to story 1 of document 1 --check in the story tell storyRef to check in set savePath to saveFolder & ":" & storyStr & ".icml" save document 1 to savePath end tell on getName (promptStr) set userResponse to display dialog promptStr default answer "" default button 2 if text returned of userResponse = "" then error "Valid string not entered" end if return text returned of userResponse end getName
To have the script add the story length to the file’s saved name, make the following changes to the script above.
set storyStr to getName("Enter name for story")
set b to baseline of line -1 of storyRef set storyLen to "" & (b - 0.5) set storyName to my checkName(storyStr, storyLen) --check in the story tell storyRef to check in set savePath to saveFolder & ":" & storyName & ".icml" save document 1 to savePath end tell
(*truncates name and replaces dot with a hyphen*) on checkName(storyStr, storyLen) set lengthStr to "" & storyLen --convert number to string set theOset to offset of "." in lengthStr if theOset > 0 then set startSnip to text 1 thru (theOset - 1) of lengthStr set endSnip to text (theOset + 1) thru (theOset + 3) of (lengthStr & "000") set storyName to storyStr & "_" & startSnip & "-" & endSnip end if return storyName end checkName
Note: Using the code above for calculating the baseline of the last paragraph only works if the story fits within one InCopy page. If the story flows to more than one page, you would need to get a count of the pages and multiply that by the column depth for each full page and then add that to the baseline of the last paragraph.
Keep in mind that in either event the calculation may be off slightly if the InCopy story is flowed into a multi-column text frame. Even though the column widths are setup to be the same, line breaks can change when going from a single column to a multi-column layout. This may pose a problem in using an edit-first workflow as multiple columns are not supported from the InCopy side. (They are supported if the story is initiated in InDesign.) When line breaks are not a primary consideration, you may decide to have the text area width in the InCopy template set to the total column width for the target text frame. For this you would have the script test the value for the text area width and modify the length of the story accordingly:
--in script above place the following after the tell statement to InCopy tell document preferences of document 1 set colWidth to text area width end tell --after setting the value for the variable storyLen, add the following if colWidth < 2.57 then --testing for single InCopy column set storylen to (storyLen /2) --for 2 column InDesign text frame end if
As an example, a typical story edited as a single column and then as a double column in InCopy gave the same story depth result when saved.
As you can see in the above, the story depths were consistent whether using a text area width set up for the single or the double-column width. These numbers were off slightly from the actual depth of the InDesign story (4.138 inches as opposed to 4.284 inches).
Even though the story depths are off slightly when using the Edit-first workflow in a multi-column environment, the layout artist on the InDesign side can plan pages based on the story depths provided. Our sample code saved the InCopy stories to a folder in Creative Cloud that was set up for a collaborative workflow. If access to Creative Cloud is an issue, you can use DropBox or Google Drive as your location for saving edited InCopy files.