🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.scripting.indesign
2 messages
2 total messages Started by Seth_McGraw Fri, 30 Jan 2009 18:48
Change name of Layers
#1567
Author: Seth_McGraw
Date: Fri, 30 Jan 2009 18:48
7 lines
1041 bytes
I would like to change the name of the default layer to the result of a dialog entry.

example: In the dialog the user has the choice of two words, "Silkscreen" or "Litho". Whatever the user chooses I would like the default document layer to be renamed in like. I then will need to call on this layer by name later in script.

note: Their has been a truckload of stuff already happening on this layer, so creating a layer is not an option at this point.

Any ideas would be greatly appreciated.
Re: Change name of Layers
#1571
Author: Kasyan_Servetsky
Date: Fri, 30 Jan 2009 19:34
30 lines
1376 bytes
Hi Seth McGraw,

What do you mean saying 'default layer': the active layer or "Layer 1"?
The following script renames the active layer.

Kasyan


 
var myDoc = app.activeDocument;
var myListOfLayerNames = ["Silkscreen", "Litho"];

var myDialog = app.dialogs.add({name:"Select a new name for the layer", canCancel:true});
var myColumn = myDialog.dialogColumns.add();
var myPanel = myColumn.borderPanels.add();
with (myPanel.dialogColumns.add()) {
   var myDD = dropdowns.add({stringList:myListOfLayerNames, selectedIndex:0});
}
if (myDialog.show() == true) {
   try {  
      myDoc.activeLayer.name = myListOfLayerNames[myDD.selectedIndex];
   }
   catch(e) {
      alert("Some error occured.");
   }
   myDialog.destroy();
}
else{
   myDialog.destroy();
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads