Copy link to clipboard
Copied
I'm trying to figure out if there's a way to dynamically place elements based on the length of a variable text string. I have a few images that I'm creating with variables where there are two text strings centered and stacked. Those are all working perfectly because nothing on the image needs to move in relation to other variable data. The third image I'm working on has a text variable (that varies quite a bit in character length), a graphic element (not a variable) to the right of it, and then another text variable. I'm trying to figure out if there's a way to move the graphic element to the right of the first text variable based on what data is inputted (e.g. if the variable text string is 3 characters the graphic element should be say, 20 px to the right but if the variable text string is 15 characters, the graphic element should still be 20 px to the right - but in a totally different position than the case of the 3 character text string).
If the graphic between the two varialbles must be variable (or something other than text), you can:
Then record an Action which:
Copy link to clipboard
Copied
Which version of Illustrator are you using?
Can you provide a sample .ai file with detailed instructions? Or can you at least post some screenshots that may explain your task?
Copy link to clipboard
Copied
I'm using CC 2018

So I'm trying to figure out if there's a way to move the graphic element (in this case the blue bar) and the variable on the right, based on the character length of the text variable on the left which needs to stay left-aligned. So in one data set, I might have both "cat" and "Mississippi" - in the case of "cat" the blue bar and the second variable would need to move left to maintain the distance of the first variable to the blue bar and the second variable to the blue bar but in the case of "Mississippi" everything would have to move a bit to the right. I'm trying to do a batch export of a large number of files, all of which have variables that vary in character length. the character length of the second variable (on the right) doesn't matter because it's also left-aligned and there's nothing to the right of it. Does that make sense?
Copy link to clipboard
Copied
Easiest way would be to pre-define a slot length say '30 characters' and just pad you variable (i.e. text 'string' with space characters concatenated with it)
Left = 'Left '
Right = ' Right'
Just make an excel file or something that will pad in the extra spaces
'x' being a 'space'
'xxxxxxxxxxx' (full maximum length of your variables/list items)
put 'cat' in there...
'xxxxCATxxxx'
'CATxxxxxxxx'
'xxxxxxxxCAT'
Copy link to clipboard
Copied
Thanks for your response. This doesn't seem to address moving the actual graphic element. What I'm trying to do is dynamically place the blue bar and the following text variable based on how long the first word is. Adding spaces in each variable I don't think would do anything to the static graphic element as the graphic element isn't part of the first text variable.
Copy link to clipboard
Copied
I wonder if you are always using plain elements like the blue rectangle or if you are going to use any kind of graphic symbol.
Also, is it just one text variable or two separate variables?
Copy link to clipboard
Copied
well if its a predictable 'pattern' aka... a certain number range of possible numbers.. make group, label them by character length (15 is here, 10 is there)
then make some data to import.. have one of the columns be the 'length' .. which would correspond with the group name '10', '15'
Here's an article... you can make 'visibility' of groups/layers controlled by the data... 'turn on this one for this length.. etc)
Data-driven graphics through templates and variables in Illustrator
....
But if what your picture shows .. a generic blue bar ... type '|' ... color it blue then make red text and again pad with spaces.
they can now both appear to move based on the spaces idea from above.
xxxx | Variable
xxxxxxxxxxxxxxxxxxxx | Variable
Other than that I'd recommend taking better pictures of your idea for us to dissect.
Until then experimenting/testing is your best bet
Copy link to clipboard
Copied
The reason people are asking you for a more thorough description of the requirements is because the way you've described it so far suggests you could simply do it using regular typography if it's just a vertical bar and there's no reason why the whole string can't be in a single variable:
Cat | Mississippi
Mississippi | Cat
JET
Copy link to clipboard
Copied
If the graphic between the two varialbles must be variable (or something other than text), you can:
Then record an Action which:
JET
Copy link to clipboard
Copied
Oh interesting. I tried using an action to align things but didn't get it quite right. Your suggestion might work! Thank you. As to your previous response, the text is in separate variables because different data needs to go into each variable. This is for generating thousands of files so things like adding spaces based on the characters in a variable or trying to combine variables in a spreadsheet would be super time consuming. I'll try the alignment action as you suggest and let you know! Thanks for your help!
Copy link to clipboard
Copied
padding data with spaces takes under a minute. (100 to 100,000,000 variables)
You need to start experimenting with workflows to see how things actually behave
Copy link to clipboard
Copied
This worked perfectly! Thanks so much for your help!
Copy link to clipboard
Copied
You're welcome. Just as follow-up:
…so things like adding spaces based on the characters in a variable or trying to combine variables in a spreadsheet would be super time consuming.
Just for the record, padding with spaces in a spreadsheet is not "super time consuming." It's practically instantaneous assuming you are using something capable of text calculations (FIleMaker Pro, Excel, etc.). But the very concept of using multiple consecutive spaces (or carriage returns) for spacing anything just makes me cringe, as a matter of designerly principle. 😉
As to your previous response, the text is in separate variables because different data needs to go into each variable.
That alone doesn't prevent your working with a single variable either, if the vertical bar can just be a text character. Surely you're not just using Illustrator as the data entry mechanism for thousands of records?
As with merely adding spaces by a text calculation, anything with text functions can automate the creation of a single text string from multiple data values. For example, suppose value of the left variable is to be EmployeeName, and the value of the right variable is Company. The first column of the spreadsheet would typically be EmployeeName. The second column would automatically populate from a one-to-many relationship. The third column could just be a text calc which combines the first and second column values separated by a vertical bar into one string. Just that third column would be exported for use as the values for a single variable in Illustrator.
Doing that wouldn't yield the different formatting for the bar character, but that could be done with Find and application of a Character Style, which also could be automated with an Action.
JET
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more