When it comes to creating assignments for an InCopy workflow with a script, two main approaches come to mind:

  • Begin by creating an assignment for each user within the workgroup all at once and then add stories to those assignments later as needed. With this option, each user would have only one assignment named consistent with their user name.
  • Create assignments when stories are assigned basing the name of the assignment on a classification for the story, such as “Features”, “Inside”, and so forth. You could add the name of the user to the assignment to further identify it, as in “Features_John”, “Inside_Alice”.

When a story or story container is added to an assignment using a script, the basic process involves two steps:

  • Export the story to a file using InCopy markup format (which creates an unassigned story)
  • Move the unassigned story to the appropriate assignment

You can see how this is accomplished with the following core code:

AppleScript

set userName to "John"
set asgnName to "test" & "_" & userName
set baseName to "Features"
tell application "Adobe InDesign CC"
	set userColor to gold --notice color is an enumeration value
	set storyRef to item 1 of selection --assumes selection is text frame
	set docRef to document 1
	tell docRef
                save
		set docPath to file path as string
		set storyPath to docPath & "Assignments:content:"
		set asgnPath to docPath & "Assignments:" & asgnName & ".icma"
		if not (exists assignment asgnName) then
			set asgnRef to make assignment with properties 
                       {name:asgnName, user name:userName, frame color:userColor, export options:assigned spreads, 
                       file path:asgnPath}
		else
			set asgnRef to assignment asgnName
		end if
		set icmlPath to storyPath & baseName & ".icml"
		tell storyRef to export format InCopy markup to icmlPath
		set unasgnRef to assignment -1
                set unasgnName to name of unasgnRef
                if unasgnName is not asgnName then
		     tell unasgnRef to move last assigned story to asgnRef
                end if
		tell asgnRef to update
		save
	end tell
end tell

ExtendScript

var myUserName = "John";
var asgnName = "test" + "_" + myUserName;
var baseName = "Features_inside";
var userColor = InCopyUIColors.GOLD;
var storyRef = app.selection[0];//assumes selection is text frame
var docRef = app.documents.item(0);
docRef.save();
var docPath = docRef.filePath.absoluteURI;
var storyPath = docPath + "/Assignments/content/"
var asgnPath = docPath + "/Assignments/" + asgnName + ".icma"
if (!docRef.assignments.itemByName(asgnName).isValid) {
    var asgnRef = docRef.assignments.add({name:asgnName, 
    userName:myUserName, frameColor:userColor, exportOption:AssignmentExportOptions.ASSIGNED_SPREADS, 
    filePath:asgnPath});
} else {
    var asgnRef = docRef.assignments.itemByName(asgnName);
}
var storyName = baseName + ".icml";
var icmlPath = new File(storyPath + storyName);
storyRef.exportFile (ExportFormat.INCOPY_MARKUP, icmlPath);
var unasgnRef = docRef.assignments.lastItem();
var unasgnName = unasgnRef.name;
if (unasgnName != asgnName) {
     unasgnRef.assignedStories.lastItem().move(LocationOptions.AT_END, asgnRef);
}
asgnRef.update();
docRef.save();

When you create assignments through the application‘s interface, the color chosen in the assignment dialog is associated with the assignment. Unless the user‘s color is chosen, there is no correlation with the user. Also, the name for the assignment folder is created using the name of the document. When you automate your workflow with a script, you can decide exactly how you want the process to work. As one scripter put it, “It’s power to the people!”.

Write Your Script

Once you map out your workflow, and assign names and colors to your users, you can start putting a script together that will save you many hours and untold amounts of stress in switching your users over to an InCopy based workflow. The code above should get you started.

Haven’t Decided on Creative Cloud Yet?

Switching from purchasing software to just paying monthly (or yearly) for a license to use is a big step. The biggest problem I could see for some users would be in having a slow connection to the internet because downloading applications can be time consuming. With a fast connection, time to download is a matter of minutes. Just make sure you have plenty of hard drive space available before you try. If you do not have enough space, you can get a bogus error such as “No connection to internet.”

If you do have a slow internet connection, you can get a disk copy for downloading. From that point on, the internet connection will just be for collaborating and for getting updates which, hopefully, will be small.

Reason One

Here is another reason for switching to Creative Cloud: The InDesign CC application code was completely rewritten from scratch to take advantage of 64-bit processing. And, yes, some problems were fixed along the way. For instance, the Extendscript version of the code above may not work in earlier versions of InDesign. (The AppleScript version does work.) To get around this problem, some pretty “gnarly” workarounds have been used, none of which I felt was satisfactory. Thankfully, this problem has been fixed.

Reason Two

One of the advantages of being a Creative Cloud member is that you get updates and new features as soon as they are ready. It has been reported that Adobe already has the next batch lined up with new features and functionality being available in the coming weeks.

Reason Three

Best of all, you can sign up for a free Creative Cloud account and try any of the new desktop applications for 30 days, as well as a selection of services.