我正在一个项目中,我需要在Illustrator中将数百个对象向上移动一层。像这样:
我想要一个键盘快捷键,用于“向上移动一层”。
我在这里找到了使用脚本的潜在解决方案:https://forums.adobe.com/thread/472211
但是它不起作用-我认为自该线程最初编写以来,脚本规范已更改。因此,我需要以下特定的帮助:如何在Illustrator中更新此旧脚本以与当前的extendScript一起使用:
//DESCRIPTION: One Layer Up
for (s=0; s<app.selection.length; s++)
{
if (app.selection[s].itemLayer.index > 0)
app.selection[s].itemLayer =
app.activeDocument.layers.previousItem(app.selection[s].itemLayer);
}
我想我已经解决了这个问题:
//DESCRIPTION: One Layer Up
var docSelected = app.activeDocument.selection;
var topLayer = app.activeDocument.layers[0];
var bottomLayer = app.activeDocument.layers[1];
for (s = 0; s < docSelected.length; s++)
{
myPath = docSelected[s];
topLayer.visible = true;
myPath.move(topLayer, ElementPlacement.PLACEATBEGINNING);
topLayer.visible = false;
}