Copy link to clipboard
Copied
Hello everyone
I need help updating a script they wrote to me:
I have a document with 3 shapes that each have a line with a different spot color:
1. Cut contour
2. Big
3. Pnimi
The script is like this:
I need the computer to recognize the spots
and will turn them into spot colors with the following values:
CutContour = R=255 G=0 B=0
Big = R=0 G=255 B=0
Pnimi = R=0 G=0 B=255
After that, will move all the lines to a new layer.
The script:
//author: William Dowling
//adobe forum username: Disposition_Dev
//email: illustrator.dev.pro@gmail.com
//linkedin: https://www.linkedin.com/in/william-dowling-4537449a/
//Adobe Discussion Forum Post about this function: https://community.adobe.com/t5/illustrator-discussions/moving-objects-with-spot-color-to-a-new-layer...
//*******//
//Did you find this useful? Would you like to buy me a cup of coffee to say thanks?
//paypal.me/illustratordev
//<3
//*******//
//Move Spot Color Items to New Layer
//
// pass the name of the spot color as a string
// and this script will move all objects with that spot color to a new layer
//arguments
//
//mySpotColorName : string. The name of the spot color you want to move to a new layer
//Dependencies
//
//none
function moveSpotColorItemsToNewLayer ( mySpotColorName )
{
var doc = app.activeDocument;
var mySpotSwatch;
for ( var i = 0; i < doc.swatches.length && !mySpotSwatch; i++ )
{
if ( doc.swatches[ i ].name.match( mySpotColorName ) )
{
mySpotSwatch = doc.swatches[ i ];
}
}
if ( !mySpotSwatch )
{
alert( "Spot color \"" + mySpotColorName + "\" not found" );
return;
}
var myLayer = doc.layers.add();
myLayer.name = mySpotColorName;
doc.selection = null;
doc.defaultFillColor = mySpotSwatch.color;
//get filled items matching the spot color
app.executeMenuCommand( "Find Fill Color menu item" );
for ( var s = 0; s < doc.selection.length; s++ )
{
doc.selection[ s ].moveToBeginning( myLayer );
}
doc.selection = null;
doc.defaultFillColor = mySpotSwatch.color;
app.executeMenuCommand( "Find Fill Color menu item" );
doc.defaultStrokeColor = mySpotSwatch.color;
app.executeMenuCommand( "Find Stroke Color menu item" );
for ( var s = 0; s < doc.selection.length; s++ ) {
doc.selection[ s ].moveToEnd( myLayer );
}
}
moveSpotColorItemsToNewLayer( "CutContour" );
//author: William Dowling
//adobe forum username: Disposition_Dev
//email: illustrator.dev.pro@gmail.com
//linkedin: https://www.linkedin.com/in/william-dowling-4537449a/
//Adobe Discussion Forum Post about this function: https://community.adobe.com/t5/illustrator-discussions/moving-objects-with-spot-color-to-a-new-layer...
//*******//
//Did you find this useful? Would you like to buy me a cup of coffee to say thanks?
//paypal.me/illustratordev
//<3
//*******//
//Move Spot Color Items to New Layer
//
// pass the name of the spot color as a string
// and this script will move all objects with that spot color to a new layer
//arguments
//
//mySpotColorName : string. The name of the spot color you want to move to a new layer
//Dependencies
//
//none
function moveSpotColorItemsToNewLayer ( mySpotColorName )
{
var doc = app.activeDocument;
var mySpotSwatch;
for ( var i = 0; i < doc.swatches.length && !mySpotSwatch; i++ )
{
if ( doc.swatches[ i ].name.match( mySpotColorName ) )
{
mySpotSwatch = doc.swatches[ i ];
}
}
if ( !mySpotSwatch )
{
alert( "Spot color \"" + mySpotColorName + "\" not found" );
return;
}
var myLayer = doc.layers.add();
myLayer.name = mySpotColorName;
doc.selection = null;
doc.defaultFillColor = mySpotSwatch.color;
//get filled items matching the spot color
app.executeMenuCommand( "Find Fill Color menu item" );
for ( var s = 0; s < doc.selection.length; s++ )
{
doc.selection[ s ].moveToBeginning( myLayer );
}
doc.selection = null;
doc.defaultFillColor = mySpotSwatch.color;
app.executeMenuCommand( "Find Fill Color menu item" );
doc.defaultStrokeColor = mySpotSwatch.color;
app.executeMenuCommand( "Find Stroke Color menu item" );
for ( var s = 0; s < doc.selection.length; s++ ) {
doc.selection[ s ].moveToEnd( myLayer );
}
}
moveSpotColorItemsToNewLayer( "Pnimi" );
//author: William Dowling
//adobe forum username: Disposition_Dev
//email: illustrator.dev.pro@gmail.com
//linkedin: https://www.linkedin.com/in/william-dowling-4537449a/
//Adobe Discussion Forum Post about this function: https://community.adobe.com/t5/illustrator-discussions/moving-objects-with-spot-color-to-a-new-layer...
//*******//
//Did you find this useful? Would you like to buy me a cup of coffee to say thanks?
//paypal.me/illustratordev
//<3
//*******//
//Move Spot Color Items to New Layer
//
// pass the name of the spot color as a string
// and this script will move all objects with that spot color to a new layer
//arguments
//
//mySpotColorName : string. The name of the spot color you want to move to a new layer
//Dependencies
//
//none
function moveSpotColorItemsToNewLayer ( mySpotColorName )
{
var doc = app.activeDocument;
var mySpotSwatch;
for ( var i = 0; i < doc.swatches.length && !mySpotSwatch; i++ )
{
if ( doc.swatches[ i ].name.match( mySpotColorName ) )
{
mySpotSwatch = doc.swatches[ i ];
}
}
if ( !mySpotSwatch )
{
alert( "Spot color \"" + mySpotColorName + "\" not found" );
return;
}
var myLayer = doc.layers.add();
myLayer.name = mySpotColorName;
doc.selection = null;
doc.defaultFillColor = mySpotSwatch.color;
//get filled items matching the spot color
app.executeMenuCommand( "Find Fill Color menu item" );
for ( var s = 0; s < doc.selection.length; s++ )
{
doc.selection[ s ].moveToBeginning( myLayer );
}
doc.selection = null;
doc.defaultFillColor = mySpotSwatch.color;
app.executeMenuCommand( "Find Fill Color menu item" );
doc.defaultStrokeColor = mySpotSwatch.color;
app.executeMenuCommand( "Find Stroke Color menu item" );
for ( var s = 0; s < doc.selection.length; s++ ) {
doc.selection[ s ].moveToEnd( myLayer );
}
}
moveSpotColorItemsToNewLayer( "Big" );
Have something to add?