Skip to main content
Inspiring
July 20, 2022
Answered

Sharing some simple JSX scripts to rename and modify swatches.

  • July 20, 2022
  • 1 reply
  • 607 views

I created a few scripts to work with swatches since I couldn't find any, so I'm paying it forward! They aren't really complex or anything. Just very simple scripts, but useful (to me at least). I'm offering them up to the community to use as you see fit.:

 

  • VSYS Swatches Prefix.jsx
  • VSYS Swatches Remove First Word.jsx
  • VSYS Swatches Remove Word.jsx
  • VSYS Swatches Rename Serialize 2Pad.jsx
  • VSYS Swatches Rename Serialize NoPad.jsx

 

You can download them all here: https://github.com/visusys/Illustrator-Swatch-Scripts

I would be overjoyed if other scripters contributed additional scripts as well to expand on this! I plan on creating a CEP plugin that includes all of this functionality into one panel. But I'm very new to CEP so this won't be happening any time soon.

Anyway here are some short descriptions of what each script does:

VSYS Swatches Prefix
This script will prefix selected swatch names with whatever you enter in the dialog.

For Example:

Blue
Red
Green
Yellow

Becomes:

Alert Blue
Alert Red
Alert Green
Alert Yellow
(With "Alert " entered in the popup window)

 

VSYS Swatches Remove First Word

This script will remove the first word from the selected swatches names.

For Example:

Carbon Blue
Carbon Red
Carbon Green
Carbon Grey

Becomes:

Blue
Red
Green
Grey
(With "Carbon " entered in the dialog)


VSYS Swatches Remove Word

This script will remove a word (that you enter in a dialog) from the selected swatches names.

For Example:

Carbon Blue
Primary Carbon OffWhite
Green Carbon
Carbon Dark Grey

Becomes:

Blue
Primary OffWhite
Green
Dark Grey
With "Carbon " entered into the dialog.


VSYS Swatches Rename Serialize NoPad

This script will completely delete the selected swatches' names and replace it with a custom base name, and then number them.

For example:

Red Swatch
Red2
Burning Red
Some other swatch

Becomes:

Red Swatches 1
Red Swatches 2
Red Swatches 3
Red Swatches 4

(With "Red Swatches " entered into the dialog when the script is run)


VSYS Swatches Rename Serialize 2Pad
This script is exactly the same as VSYS Swatches Rename Serialize NoPad but pads the numbers to two figures.

For Example:

Red Swatch
Red2
Burning Red
Some other swatch

Becomes:

Red Swatches 01
Red Swatches 02
Red Swatches 03
Red Swatches 04

(With "Red Swatches " entered into the dialog when the script is run)


Again, everything is here:  https://github.com/visusys/Illustrator-Swatch-Scripts

Here are individual links:

https://github.com/visusys/Illustrator-Swatch-Scripts/blob/main/VSYS%20Swatches%20Prefix.jsx

https://github.com/visusys/Illustrator-Swatch-Scripts/blob/main/VSYS%20Swatches%20Remove%20First%20Word.jsx

https://github.com/visusys/Illustrator-Swatch-Scripts/blob/main/VSYS%20Swatches%20Remove%20Word.jsx

https://github.com/visusys/Illustrator-Swatch-Scripts/blob/main/VSYS%20Swatches%20Rename%20Serialize%202Pad.jsx

https://github.com/visusys/Illustrator-Swatch-Scripts/blob/main/VSYS%20Swatches%20Rename%20Serialize%20NoPad.jsx

Hope all of you wonderful people find these useful!

Jay

 

This topic has been closed for replies.
Correct answer futuremotion6798557

Edit to script files location and added more scripts
I had to put this into a reply because I can't find any way to edit my posts.


The repository of the scripts has changed to: https://github.com/visusys/VSYS-Illustrator-CC-Scripts

I made this change because I intend to keep adding more Illustrator scripts as I continue to learn, and the old repository name wasn't inclusive enough.

I also optimized the original scripts and added two more:

VSYS Swatches Remove Last Word.jsx
VSYS Swatches Replace Underscores With Spaces.jsx

 

1 reply

futuremotion6798557AuthorCorrect answer
Inspiring
July 20, 2022

Edit to script files location and added more scripts
I had to put this into a reply because I can't find any way to edit my posts.


The repository of the scripts has changed to: https://github.com/visusys/VSYS-Illustrator-CC-Scripts

I made this change because I intend to keep adding more Illustrator scripts as I continue to learn, and the old repository name wasn't inclusive enough.

I also optimized the original scripts and added two more:

VSYS Swatches Remove Last Word.jsx
VSYS Swatches Replace Underscores With Spaces.jsx

 
CarlosCanto
Community Expert
Community Expert
July 21, 2022

thanks for sharing, no matter how simple you think your scripts may be I'm sure someone will find them useful either to learn how to code or to use them as is.