Need help with New Layers, Layer Names and resizing selected art #13
CreativeONE21
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm in need to make a script for when a image is selected it will resize it then moves it to a new layer with a custom name, but also with an alert if the layer that it's moving to already exist so it won't create a duplicate Layer but only resize and move to the layer.
This is what I have but it has some issues. works with one object but multiple objects it won't do the one I select.
Please help, thanks,
Manuel I
// create a new layer 1/2 scale
var newLayer = app.activeDocument.layers.add();
newLayer.name = '1/2 scale';
newLayer.zOrder(ZOrderMethod.SENDTOBACK);
//Move selected object to new layer
var doc = app.activeDocument;
var layerName = '1/2 scale';
var _layer = doc.layers.getByName(layerName);
var _selectedItems = app.selection
for (var i = _selectedItems.length - 1; i >= 0; i--) {
_selectedItems[i].move(_layer, ElementPlacement.PLACEATEND);
_selectedItems[i].selected = false;
}
app.redraw();
//Resizes selection
var doc = app.activeDocument;
var item = doc.pathItems[0];
item.resize(
50.0, // x
50.0, // y
true, // changePositions
true, // changeFillPatterns
true, // changeFillGradients
true, // changeStrokePattern
true , // changeLineWidths
undefined); // scaleAbout
Beta Was this translation helpful? Give feedback.
All reactions