Illustrator script arguments and variables

Post Reply
wwstudios
Newbie
Posts: 2
Joined: Tue Mar 12, 2024 7:29 pm

Illustrator script arguments and variables

Post by wwstudios »

Hi all,

currently working with a demo version of Switch with Illustrator.

desired workflow is to run a variable data script we use. so it would go like this:

1. open file

2. run script (fill in arguments below)
a. choose specific radio button for layer name or object name. Variable is 'r_textByName', which will be true
b. choose csv file to use (should be in the same input folder with the same 5-digit job number). variable is 'disp_csvFile'
c. define output directory. variable is 'disp_destFolder'

3. The script should then run and save pdfs (Settings defined in script) to the output directory

But what is my syntax for this?

In argument 1, I just put the following inline:

r_textByName.value = true;


Then in argument 2, for choosing the correct csv file, I'm really stumped. I need to match the csv to the Illustrator file, and I assume the easiest way is to use a variable for the file path, but how do I match it on the fly, with different 5-digit job numbers?

Finally, for argument 3, the output directory, I have this:

var disp_destFolder = [Switch.OutgoingName:Index="1"] (I had 'OUTPUT' and 'OUTPUT BAD', so I used the Index to limit it to the first one.)


obviously this isn't working at all, since I don't have argument 2 figured out in the least.

Is there a good reference for dealing with Illustrator script arguments?

Or even if there's a better method of doing variable data with Illustrator and Switch?

thanks for any help
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Illustrator script arguments and variables

Post by freddyp »

You should start from here: https://www.enfocus.com/manuals/UserGui ... tions.html. There you will find what variables Switch makes available to your script and how it works with arguments.
wwstudios
Newbie
Posts: 2
Joined: Tue Mar 12, 2024 7:29 pm

Re: Illustrator script arguments and variables

Post by wwstudios »

Awesome, thanks much!
Post Reply