Illustrator Variable Data: Bringing in editable Illustrator assets.

Illustrator Variable Data: Bringing in editable Illustrator assets.


The needed feature

In Adobe Illustrator one of the missing features of the Actions panel is the ability to open files from custom locations other than a batch folder of pre-prepared files, or to save the files in custom locations. Using variable data in Illustrator it is possible to get the art documents to appear in the master document as placed items, but sometimes we need to actually dig into the contained artwork to get its innards for various purposes. Would it not be nice to be able to open files from custom locations as part of a variable data workflow?

The test case with graphic styles

In coming up with a test case for a presentation of the Recoloring.jsx variable-recoloring script at a local meetup, decided that a demonstration of all 3 kinds of colorization is necessary.

The three kinds are: applying a process color, applying a named swatch, and applying a graphic style. The first type, applying a process color whose values come from the csv data itself is really easy and there's nothing you need to do extra. The second kind, applying a named swatch, is trickier: the swatch has to be already present in the document. If the swatch is not inside, it needs to be created in order to be applied. With spot colors there's a helping hand: whichever spot color is visible inside a placed document, it shall appear inside the document into which the placed item was placed. Therefore you need only to have a folder full of files with separate spot colored shapes (you can import entire groups with multiple colored shapes per document) and these can be referenced by the file paths specified in the CSV! However, gradient and pattern swatches are not treated as kindly, and the only methods to bring those into a document are by clicking in an open Swatch Library panel, or pasting an art object which has such a swatch applied. The third type of recoloring via the recoloring script is application of a graphic style, by name. Just like pattern and gradient swatches, graphic styles can be brought into a document by hitching a ride on a pasted art shape.

Since I wanted to demonstrate the graphic style recoloring in a situation where those styles were not yet in the document, I wanted to see if they could still somehow be pasted into the current document from a file reference in the variable data csv. (And without any edits to the very generic Recoloring.jsx script.)

Edit Original to the Rescue

I got an idea that if the Edit Original button could be recorded into an action, then it would be able to open a placed Illustrator file as a new active document, where the action can select all and copy, close the active document (as it would have had no changes) , then paste the copied art into the now re-activated current document.

I tried to record an action and press the Edit Original button, but it didn't work. Luckily, this command can be recorded with the Insert Menu Command of the fly-out panel in the Actions palette. I was then able to construct the action which does the following:

  1. sets the selection to a group which contains one placed item in the document
  2. performs Edit Original on the selected item (which works on the placed item inside its container group, as both are selected)
  3. selects all in the active document 
  4. does a copy
  5. closes active document
  6. deselects all
  7. pastes into the original active document

The reason the placed item was wrapped in a group is because when variable datasets change the placed artwork, the associated notes simply disappear.

Keeping this placed item inside of a group meant that the group's notes would always stay, and the item could always be selected with the action's "select object whose note is.." feature.

The Edit Original command used inside the action is the abstraction bridge which is able to essentially perform the "File Open" command on a variable file inside the document!

file navigation is one of the most draining work-activities in one's day

The proof scenario

Then it was time to test this experiment. My proof-of-concept goal was to import a set of artwork into an active document, coming from file references in a .csv file, for the purposes of importing graphic styles. Theoretically, you can actually save a lot of setup time in such a situation where populating a template with other complex assets is a necessary yet time-consuming task: file navigation is one of the most draining work-activities in one's day, and this method provides a means to automate in batches for some specific needs.

In my case, the pasted artwork would be temporary, with manual clean-up performed by the user after the graphic styles appeared in the document.

  1. The data: my data was a single column with an '@' prefix to tell VariableImporter.jsx that this is an image variable. There, I listed names of the 13 graphic style files whose contents I'd like to paste into the current document.
  2. The template: in this template, I just have the placed item which references a file called 'placeholder.ai', a simple document containing an empty rectangle. This placed file is wrapped in a group, with special notes which let actions select the entire item.
  3. The action: the "Bring in Asset" action. The action which I made is listed following this list.
  4. The files: a folder resembling a library of images, containing my source files. Using variable data csv, they can come from all different folders!
/version 3
/name [ 4
	74657374
]
/isOpen 1
/actionCount 1
/action-1 {
	/name [ 12
		4272696e67496e4173736574
	]
	/keyIndex 0
	/colorIndex 0
	/isOpen 1
	/eventCount 7
	/event-1 {
		/useRulersIn1stQuadrant 0
		/internalName (adobe_setSelection)
		/localizedName [ 13
			5365742053656c656374696f6e
		]
		/isOpen 0
		/isOn 1
		/hasDialog 0
		/parameterCount 3
		/parameter-1 {
			/key 1952807028
			/showInPalette 4294967295
			/type (ustring)
			/value [ 16
				7265706c61636561626c655f66696c65
			]
		}
		/parameter-2 {
			/key 2003792484
			/showInPalette 4294967295
			/type (boolean)
			/value 0
		}
		/parameter-3 {
			/key 1667330917
			/showInPalette 4294967295
			/type (boolean)
			/value 1
		}
	}
	/event-2 {
		/useRulersIn1stQuadrant 0
		/internalName (adobe_commandManager)
		/localizedName [ 16
			416363657373204d656e75204974656d
		]
		/isOpen 0
		/isOn 1
		/hasDialog 0
		/parameterCount 3
		/parameter-1 {
			/key 1769238125
			/showInPalette 4294967295
			/type (ustring)
			/value [ 22
				456469744f726967696e616c204d656e75204974656d
			]
		}
		/parameter-2 {
			/key 1818455661
			/showInPalette 4294967295
			/type (ustring)
			/value [ 13
				45646974204f726967696e616c
			]
		}
		/parameter-3 {
			/key 1668114788
			/showInPalette 4294967295
			/type (integer)
			/value 2164261253
		}
	}
	/event-3 {
		/useRulersIn1stQuadrant 0
		/internalName (adobe_selectAll)
		/localizedName [ 10
			53656c65637420416c6c
		]
		/isOpen 0
		/isOn 1
		/hasDialog 0
		/parameterCount 0
	}
	/event-4 {
		/useRulersIn1stQuadrant 0
		/internalName (adobe_copy)
		/localizedName [ 4
			436f7079
		]
		/isOpen 0
		/isOn 1
		/hasDialog 0
		/parameterCount 0
	}
	/event-5 {
		/useRulersIn1stQuadrant 0
		/internalName (adobe_closeDocument)
		/localizedName [ 5
			436c6f7365
		]
		/isOpen 0
		/isOn 1
		/hasDialog 0
		/parameterCount 0
	}
	/event-6 {
		/useRulersIn1stQuadrant 0
		/internalName (adobe_deselectAll)
		/localizedName [ 12
			446573656c65637420416c6c
		]
		/isOpen 0
		/isOn 1
		/hasDialog 0
		/parameterCount 0
	}
	/event-7 {
		/useRulersIn1stQuadrant 0
		/internalName (adobe_pasteInFront)
		/localizedName [ 14
			506173746520696e2046726f6e74
		]
		/isOpen 0
		/isOn 1
		/hasDialog 0
		/parameterCount 0
	}
}

In the VariableImporter dialog, I set the prepended path to my lone image variable to draw from the folder where my files are all located. However, absolute paths could have been used in the CSV to pull in files from different folders.

In the Batch Actions dialog, since no saving or exporting will be used during this dataset batch process, I set the override save commands and override export commands checkboxes to un-checked. Then, it's watching it with crossed fingers after rubbing the Buddha's belly, after pressing that Ok button.

The result

It took about 41 seconds to populate in 13 graphic styles

In normal (non-batch) context it works just great! The major problem came up when using this action as part of a batch processing of variable data sets. Instead of opening the document, Edit Original command had no effect. Disappointed, I tried to do this with the Actions playback mode as "step-by-step". Interestingly, it worked! The downside is how much slower this method is. It took about one minute and fifteen seconds to populate in 13 graphic styles. This is is less than 6 seconds per file, so already the benefit is seen compared to manual file navigation and clicking. Yet the methodical nature of this action playback mode is much slower than the Accelerated mode, or using a custom script to accomplish the same. The basic mechanism here is to consolidate the navigation activities to a spreadsheet input and this automated action.

[EDIT] A new speed breakthrough!

Thanks to Stephen Marsh's advice, I changed the "Pause for" setting in the Playback Options to 0.1 seconds, and saw amazing results which nearly halved the performance time! Now it took only 41 seconds to paste in all the shapes. This yields a length of about 3 seconds per file. I think that little pause is just essential for something about the Actions to make it really work.

The result was satisfactory for achieving my goal: the new graphic styles were pasted into the document from custom file references. This could be applicable in situations where a library of hundreds of art assets exists and only some need to be pasted in.

Conclusion

With the ability to open documents from custom locations with full access to their art contents, this could save lots of clicks and yield a dimension of new workflows where getting into specific bits of copied art is important. After all, copied art could have a complex structure with various art having its own notes for making selections, or names and notes for recoloring purposes. In my demonstration case, this technique could be used either as a separate "pre-processing" variable data batch process before a main variable-data process, or as another action inside the variable data batch process. Others may find it useful to be able to import and even arrange the pasted art on separate artboards (with some constraints).

Due to some Actions bug involving Edit Original not working correctly when used as a Batch Process in Accelerated mode, it does take a while, so at some point at one's work journey, using a custom script to do this would surpass this method in speed.

This just popped up on my feed, has it really been four years? Excellent article (as always), please keep pushing the boundaries Vasily!

Like
Reply

Makes me wonder if the flaky behaviour that I noted in the following topic thread at the Adobe Illustrator forum was due to accelerated mode… https://forums.adobe.com/message/9762146

Vasily, please try setting the action playback to “pause for: 0.1 seconds” does this result in playback that is slower, the same or faster than “step by step” and does this also avoid the batch playback bug?

To view or add a comment, sign in

More articles by Vasily Hall

Others also viewed

Explore content categories