Skip to main content
cvreeland
Participating Frequently
January 5, 2010
Answered

Script to export swatch names as tab-delimited text?

  • January 5, 2010
  • 2 replies
  • 2988 views

Howdy!

I run the screen printing department at a large shipping company, and as we grow, we're trying to integrate & computerize our workflow. 95% of the designs we have on file are built as spot color in Illustrator.

We're trying to automate some functions here in the screen-making department, such as a computer-generated inventory of screens on-hand. When we image a screen, it'll get a barcode sticker and we can then *beep* it into inventory. When we reclaim a screen we can *beep* it out of inventory. My thinking is that this would be a metric ton faster than wandering around on the shop floor looking for screens when clients placed re-orders.

In order to do that, I've got to generate a spreadsheet with the name of each color in the design in its own field of a spreadsheet, so that they can be used to populate our inventory system and get assigned SKU's.

I can do this manually, but it's going to take a long time. What I was sort of half-heartedly wishing for was a way to export the names of all the spot swatches used in a design as text, hopefully tab-delimited so that it can be copy/pasted into a spreadsheet.

Am I nuts?

This topic has been closed for replies.
Correct answer Muppet_Mark-QAl63s

Okay, I'm a total n00b at this. How do I get that to run? I tried pasting it into /Applications/Applescript/Script Editor and hitting the "compile" button, but I get a syntax error "A Identifier cant go after this identifier" and it highlights the first half of the first line "var defaultFolder" before the = sign.

How should I save/execute that script?


Chris, sorry the above is NOT AppleScript that goes into Apple's Script Editor app. It's ExtendScript, what you need to do to use this is C&P into ExtendScript Toolkit. This should have been installed along with CS and should be situated in you Utilities Folder in 'Adobe Utilities' folder. Open this app make new document paste the above in and save to file with whatever you want to call this with the '.jsx' file suffix/extension. Quit Illustrator pop this file into Illustrators 'Scripts' folder in 'Presets' relaunch Illustrator it should be there. It does NOT actually require Illustrator at all.

Let me know how you get on.

2 replies

January 6, 2010

That seems like a relatively easy task, depending on your OS, scripting language, and Illustrator version.

You can of course write the list of names directly to a spreadsheet--you don't need to create an intermediate document. A script can interact with multiple applications.

Where are you at right now? Do you have some scripts you are currently writing? What language are they in?

cvreeland
cvreelandAuthor
Participating Frequently
January 11, 2010

Thanks, both of you and sorry for the late reply --

I'm running CS3 on a PPC Mac, OS 10.5.8. I have no idea how to write any sort of script unless it's a GUI thing like Automator or recording an action, so I've done no scripting with this as of yet.

The only swatches in any of my final print files are the defaults that won't go away, (None, Black, White & Registration) and whatever swatches are actually used in the file -- generally pulled from the Pantone Solid Coated library, but always spot, even if they're custom.

I keep the files in separate directories, (/Art/Year/Month/Client/Design) so I don't think batching a directory would work -- I don't think I'd want to batch them anyway, since I keep the original client file for reference alongside my final print file. I'd be happy to extract this info one job at a time, as I have about 150 files total at this point I'd like to do this to, and a few months to do this project.

I guess what I'd like to come away with is either an action I could run when the file is open, or something like a droplet I could drop the file onto. I'm open to whatever approach seems to make the most sense, and am willing to dive in to learning some sort of scripting language if I can take this away as a tangible result of the project. It'll do me some good to learn, anyway.

Thanks!

Muppet_Mark-QAl63s
Inspiring
January 11, 2010

Thanks, I was busy figuring that out just now. :-) It spits out pretty much exactly what I was looking for!

Is there a way to replace the tabs with hard returns (or whatever works) so that the info will paste vertically into cells in the same column instead of horizontally in the same row in Excel?

Edit: what would the changes be to get this to work on individual files instead of a directory? Thanks again!


Im NOT a big user of Excel at all only have it on my home mac to open the odd file or two. From writing the text file this I think would be much more difficult to do (If you were to do this as batch with multi files for single files NO problem). Is there NO way to flip this data from in Excel?

Muppet_Mark-QAl63s
Inspiring
January 6, 2010

Chris, you are NOT nuts this info can be got from either opening the file and reading thru the swatches/spots/inks collections then writing to text file. Or reading this info from the file's header info from:

%%DocumentCustomColors:

down to

%%CMYKCustomColor:

Between these should be the list of 'used in document' custom colors. You can check this by opening in any text editor app.

Do you have any more info on your files that may help? What OS are you on where are the files all in one folder? What format are they in?

If they were to be opened would it be just these colors in the swatches palette?