Highlighted

Script Required

Explorer ,
Sep 09, 2020

Copy link to clipboard

Copied

Pkease provide script for below

 

1. Select Backward Layer

2. Rename with "auto123.."

3. Select Forward Layer

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hello,

Try following snippet

//Select Backward layer
var idslct = charIDToTypeID("slct");
var desc53 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref8 = new ActionReference();
var idLyr = charIDToTypeID("Lyr ");
var idOrdn = charIDToTypeID("Ordn");
var idBckw = charIDToTypeID("Bckw");
ref8.putEnumerated(idLyr, idOrdn, idBckw);
desc53.putReference(idnull, ref8);
var idMkVs = charIDToTypeID("MkVs");
desc53.putBoolean(idMkVs, false);
var idLyrI = charIDToTypeID("LyrI");
var list9 = new ActionList();
list9.putInteger(17);
desc53.putList(idLyrI, list9);
executeAction(idslct, desc53, DialogModes.NO);


//Rename Layer
var idset = stringIDToTypeID("set");
var desc8 = new ActionDescriptor();
var idnull = stringIDToTypeID("null");
var ref5 = new ActionReference();
var idlayer = stringIDToTypeID("layer");
var idordinal = stringIDToTypeID("ordinal");
var idtargetEnum = stringIDToTypeID("targetEnum");
ref5.putEnumerated(idlayer, idordinal, idtargetEnum);
desc8.putReference(idnull, ref5);
var idto = stringIDToTypeID("to");
var desc9 = new ActionDescriptor();
var idname = stringIDToTypeID("name");
desc9.putString(idname, """auto123...""");
var idlayer = stringIDToTypeID("layer");
desc8.putObject(idto, idlayer, desc9);
executeAction(idset, desc8, DialogModes.NO);


//Select forward Layer
var idslct = charIDToTypeID("slct");
var desc52 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref7 = new ActionReference();
var idLyr = charIDToTypeID("Lyr ");
var idOrdn = charIDToTypeID("Ordn");
var idFrwr = charIDToTypeID("Frwr");
ref7.putEnumerated(idLyr, idOrdn, idFrwr);
desc52.putReference(idnull, ref7);
var idMkVs = charIDToTypeID("MkVs");
desc52.putBoolean(idMkVs, false);
var idLyrI = charIDToTypeID("LyrI");
var list8 = new ActionList();
list8.putInteger(18);
desc52.putList(idLyrI, list8);
executeAction(idslct, desc52, DialogModes.NO);

 

TOPICS
Actions and scripting

Views

59

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Script Required

Explorer ,
Sep 09, 2020

Copy link to clipboard

Copied

Pkease provide script for below

 

1. Select Backward Layer

2. Rename with "auto123.."

3. Select Forward Layer

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hello,

Try following snippet

//Select Backward layer
var idslct = charIDToTypeID("slct");
var desc53 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref8 = new ActionReference();
var idLyr = charIDToTypeID("Lyr ");
var idOrdn = charIDToTypeID("Ordn");
var idBckw = charIDToTypeID("Bckw");
ref8.putEnumerated(idLyr, idOrdn, idBckw);
desc53.putReference(idnull, ref8);
var idMkVs = charIDToTypeID("MkVs");
desc53.putBoolean(idMkVs, false);
var idLyrI = charIDToTypeID("LyrI");
var list9 = new ActionList();
list9.putInteger(17);
desc53.putList(idLyrI, list9);
executeAction(idslct, desc53, DialogModes.NO);


//Rename Layer
var idset = stringIDToTypeID("set");
var desc8 = new ActionDescriptor();
var idnull = stringIDToTypeID("null");
var ref5 = new ActionReference();
var idlayer = stringIDToTypeID("layer");
var idordinal = stringIDToTypeID("ordinal");
var idtargetEnum = stringIDToTypeID("targetEnum");
ref5.putEnumerated(idlayer, idordinal, idtargetEnum);
desc8.putReference(idnull, ref5);
var idto = stringIDToTypeID("to");
var desc9 = new ActionDescriptor();
var idname = stringIDToTypeID("name");
desc9.putString(idname, """auto123...""");
var idlayer = stringIDToTypeID("layer");
desc8.putObject(idto, idlayer, desc9);
executeAction(idset, desc8, DialogModes.NO);


//Select forward Layer
var idslct = charIDToTypeID("slct");
var desc52 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref7 = new ActionReference();
var idLyr = charIDToTypeID("Lyr ");
var idOrdn = charIDToTypeID("Ordn");
var idFrwr = charIDToTypeID("Frwr");
ref7.putEnumerated(idLyr, idOrdn, idFrwr);
desc52.putReference(idnull, ref7);
var idMkVs = charIDToTypeID("MkVs");
desc52.putBoolean(idMkVs, false);
var idLyrI = charIDToTypeID("LyrI");
var list8 = new ActionList();
list8.putInteger(18);
desc52.putList(idLyrI, list8);
executeAction(idslct, desc52, DialogModes.NO);

 

TOPICS
Actions and scripting

Views

60

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 09, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

Hello,

Try following snippet

//Select Backward layer
var idslct = charIDToTypeID("slct");
var desc53 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref8 = new ActionReference();
var idLyr = charIDToTypeID("Lyr ");
var idOrdn = charIDToTypeID("Ordn");
var idBckw = charIDToTypeID("Bckw");
ref8.putEnumerated(idLyr, idOrdn, idBckw);
desc53.putReference(idnull, ref8);
var idMkVs = charIDToTypeID("MkVs");
desc53.putBoolean(idMkVs, false);
var idLyrI = charIDToTypeID("LyrI");
var list9 = new ActionList();
list9.putInteger(17);
desc53.putList(idLyrI, list9);
executeAction(idslct, desc53, DialogModes.NO);


//Rename Layer
var idset = stringIDToTypeID("set");
var desc8 = new ActionDescriptor();
var idnull = stringIDToTypeID("null");
var ref5 = new ActionReference();
var idlayer = stringIDToTypeID("layer");
var idordinal = stringIDToTypeID("ordinal");
var idtargetEnum = stringIDToTypeID("targetEnum");
ref5.putEnumerated(idlayer, idordinal, idtargetEnum);
desc8.putReference(idnull, ref5);
var idto = stringIDToTypeID("to");
var desc9 = new ActionDescriptor();
var idname = stringIDToTypeID("name");
desc9.putString(idname, """auto123...""");
var idlayer = stringIDToTypeID("layer");
desc8.putObject(idto, idlayer, desc9);
executeAction(idset, desc8, DialogModes.NO);


//Select forward Layer
var idslct = charIDToTypeID("slct");
var desc52 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref7 = new ActionReference();
var idLyr = charIDToTypeID("Lyr ");
var idOrdn = charIDToTypeID("Ordn");
var idFrwr = charIDToTypeID("Frwr");
ref7.putEnumerated(idLyr, idOrdn, idFrwr);
desc52.putReference(idnull, ref7);
var idMkVs = charIDToTypeID("MkVs");
desc52.putBoolean(idMkVs, false);
var idLyrI = charIDToTypeID("LyrI");
var list8 = new ActionList();
list8.putInteger(18);
desc52.putList(idLyrI, list8);
executeAction(idslct, desc52, DialogModes.NO);

 

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 09, 2020 2