Layer Visibility Overrides for all Instances of a linked file

Explorer ,
Jul 15, 2019

Copy link to clipboard

Copied

Is there a way to remove “layer visibility overrides” from all instances of a linked Illustrator file in InDesign? Example: I have 25 instances of an illustrator file and I want to change all of the instances to “use PDF layer visibility” without changing each manually.  Or alternatively, select all instances of a linked file and set all the visible layers for all instances in one place. 

Well,

just for the heck of it I added a third button that inverts the selection.

blv1-4.png

#targetengine "batchLayerVisibility"

var graphicInstances = null, instancesCount = null, checkboxes = null, ui_layerList = null, sel = null, pbarWindow = null, pbar_layer, pbarText;

main();

function main() {

	proceed = false;

	if (app.selection.length == 0) {
		alert("Nothing selected.");
		exit();
	}

	sel = app.selection[0];
	
	sel = sel instanceof PDF ? sel : sel.graphics[0];
	try {
		var test = sel.graphicLayerOptions.graphicLayers;

		if (test.length == 0) {
			alert("Selected object not supported.");
			exit();
		}

		} catch (err) {
			alert("Please select an .AI image with the white selection tool or click in the links panel on the graphic.");
			
			exit();
		}
		
		var graphicFile = sel.itemLink.filePath;

		graphicInstances = [];

		var allGraphics= app.activeDocument.allGraphics;

    // collect instances

    for (var i = 0; i < allGraphics.length; i++) {

	if (allGraphics[i].itemLink == null) {
		continue;
	}

	if (allGraphics[i].itemLink.filePath == graphicFile) {
		graphicInstances.push(allGraphics[i]);
	}
    }
	
	instancesCount = graphicInstances.length;

	makeDialog();
}

function makeDialog() {
	var w = new Window("dialog", "Batch Layer Visibility 1.4");
	w.alignChildren = ["fill", "fill"];
	checkboxes = [];
	
	var panel = w.add("panel", undefined, "Page x of y");
	panel.alignChildren = ["fill", "fill"];
	
	var panelStack = panel.add("group");
	panelStack.orientation = "stack";
	
	var g_options = graphicInstances[0].graphicLayerOptions;
	var g_layers = graphicInstances[0].graphicLayerOptions.graphicLayers;
	var g_layersCount = g_layers.length;
	
	var layersPerPage = 10;
	var pages2create = (g_layersCount / layersPerPage);
	pages2create = g_layersCount % layersPerPage == 0 ? pages2create : pages2create +1;
	var stackPages = [];
	var curLayer = 0;
	
	for (var p = 0; p < pages2create; p++){
		stackPages.push(panelStack.add("group"));
		stackPages[p].orientation = "column";
		stackPages[p].alignment = ["fill", "top"];
		
		for (var i = 0; i < layersPerPage; i++){
			//curLayer++;
			
			var cb_group = stackPages[p].add("group");
			cb_group.alignment = ["fill", "fill"];
			cb_group.orientation = "row";
			checkboxes.push( cb_group.add("checkbox") );
			
			var cb_label = cb_group.add("statictext", undefined, g_layers[curLayer].name);
			checkboxes[curLayer].value = g_layers[curLayer].currentVisibility;
			
			curLayer++;
			
			if(curLayer > g_layersCount -1){
				break;
			}
		}
		
		if (p == 0){
			stackPages[p].visible = true;
		} else {
			stackPages[p].visible = false;
		}
		
		if(curLayer > g_layersCount -1){
			break;
		}
	}
	
	panel.text = "Page 1 of " + stackPages.length;
	
	var btnsPanel = w.add("group");
	btnsPanel.orientation = "column";
	
	var selectBtns = btnsPanel.add("panel");
	selectBtns.orientation = "row";
	selectBtns.alignment = ["fill", "bottom"];
	selectBtns.alignChildren = ["fill", "fill"];
	selectBtns.orientation = "row";
	
	var selectAllBtn = selectBtns.add("button", undefined, "Select all");
	var invertAllBtn = selectBtns.add("button", undefined, "Invert Selection");
	var deselectAllBtn = selectBtns.add("button", undefined, "Deselect all");
	
	selectAllBtn.onClick = function(){
		for (var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = true;
		}
	}
	
	deselectAllBtn.onClick = function(){
		for(var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = false;
		}
	}
	
	invertAllBtn.onClick = function(){
		for(var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = checkboxes[i].value == true ? false : true;
		}
	}
	
	var pageBtns = btnsPanel.add("panel");
	pageBtns.alignment = ["fill", "bottom"];
	pageBtns.alignChildren = ["fill", "fill"];
	pageBtns.orientation = "row";
	
	var prevBtn = pageBtns.add("button", undefined, "Previous Page");
	var nextBtn = pageBtns.add("button", undefined, "Next Page");
	
	var curPage = 0;
	
	prevBtn.onClick = function(){
		if(curPage == 0){
			return;
		}
		
		stackPages[curPage].visible = false;
		stackPages[curPage -1].visible = true;
		panel.text = "Page " +  (curPage) + " of " + stackPages.length;
		
		if(curPage > 0){
			curPage--;
		}

	}
	
	nextBtn.onClick = function(){
		if(curPage == stackPages.length -1){
			return;
		}
		
		stackPages[curPage].visible = false;
		stackPages[curPage +1].visible = true;
		panel.text = "Page " +  (curPage +2) + " of " + stackPages.length;
		
		if(curPage < stackPages.length -1){
			curPage++;
		}
	}
	
	update_options = [];   
	
	updateOptionsPanel = w.add("panel", undefined, "Link Update Options");
	updateOptionsPanel.alignChildren = ["fill", "fill"];
	update_options[0] = updateOptionsPanel.add("radiobutton", undefined, "PDF Visibility");
	update_options[1] = updateOptionsPanel.add("radiobutton", undefined, "Custom Visibility");   
	
	if (sel.graphicLayerOptions.updateLinkOption.toString() == "APPLICATION_SETTINGS") {
		update_options[0].value = true;
	} else {
		update_options[1].value = true;
	} 
	
	var btnGrp = w.add("group");
	
	btnGrp.orientation = "row";   
	
	var closeBtn = btnGrp.add("button", undefined, "Exit", {name: "cancel"});
	
	closeBtn.onClick = function () {
		w.close();
		exit();
	}   

	var exeBtn = btnGrp.add("button", undefined, "OK", {name: "ok"});
	
	if(w.show() ==1) {
		app.doScript(setVisibility, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.entireScript, "Batch Layer Visibility");
	}
}

function setVisibility() {
	pbar();
	var graphicFile = sel.itemLink.filePath;
	for (var c = 0; c < checkboxes.length; c++) {
		var allGraphics= app.activeDocument.allGraphics;
		
		// seek instances and change visibility
		
		for (var i = 0; i < allGraphics.length; i++) {
			if (allGraphics[i].itemLink == null) {
				continue;
			}
			
			if (allGraphics[i].itemLink.filePath == graphicFile) {
				allGraphics[i].graphicLayerOptions.graphicLayers[c].currentVisibility = checkboxes[c].value;
				pbar_layer.value++;
				pbarText.text = "Layer " + (c+1) + " of " + checkboxes.length; 
			}
		}
	}
	
	allGraphics = app.activeDocument.allGraphics;
	
	// set link update option
	for (var i = 0; i < allGraphics.length; i++) {
		if (allGraphics[i].itemLink == null) {continue;}
		if (allGraphics[i].itemLink.filePath ==graphicFile) {
			if (updateOptionSel = updateOptionsPanel.children[0].value == true) {
				allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.APPLICATION_SETTINGS;
			} else {
				allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.KEEP_OVERRIDES;
			}
			
			pbar_layer.value++;
		}
	}
	
	pbarWindow.close();
}

function setCheckboxStatus() {
	if (ui_layerList.selection.checked == true) {
		ui_layerList.selection.checked = false;
	} else {
		ui_layerList.selection.checked = true;
	}

	var tempSel = ui_layerList.selection;
	ui_layerList.selection = null;
}

function pbar () {

	pbarWindow = new Window ("palette", "Processing ...", undefined);
	var pbarPanel = pbarWindow.add("panel", undefined, undefined);
	pbarText = pbarPanel.add("statictext", undefined, "Progress:");
	pbarText.alignment = ["fill","fill"];
	pbar_layer = pbarPanel.add("progressbar", undefined, 0, (instancesCount * checkboxes.length) + instancesCount);
	pbar_layer.preferredSize.width = 200;
	pbarWindow.show();

}
TOPICS
Scripting

Views

1.7K

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

Layer Visibility Overrides for all Instances of a linked file

Explorer ,
Jul 15, 2019

Copy link to clipboard

Copied

Is there a way to remove “layer visibility overrides” from all instances of a linked Illustrator file in InDesign? Example: I have 25 instances of an illustrator file and I want to change all of the instances to “use PDF layer visibility” without changing each manually.  Or alternatively, select all instances of a linked file and set all the visible layers for all instances in one place. 

Well,

just for the heck of it I added a third button that inverts the selection.

blv1-4.png

#targetengine "batchLayerVisibility"

var graphicInstances = null, instancesCount = null, checkboxes = null, ui_layerList = null, sel = null, pbarWindow = null, pbar_layer, pbarText;

main();

function main() {

	proceed = false;

	if (app.selection.length == 0) {
		alert("Nothing selected.");
		exit();
	}

	sel = app.selection[0];
	
	sel = sel instanceof PDF ? sel : sel.graphics[0];
	try {
		var test = sel.graphicLayerOptions.graphicLayers;

		if (test.length == 0) {
			alert("Selected object not supported.");
			exit();
		}

		} catch (err) {
			alert("Please select an .AI image with the white selection tool or click in the links panel on the graphic.");
			
			exit();
		}
		
		var graphicFile = sel.itemLink.filePath;

		graphicInstances = [];

		var allGraphics= app.activeDocument.allGraphics;

    // collect instances

    for (var i = 0; i < allGraphics.length; i++) {

	if (allGraphics[i].itemLink == null) {
		continue;
	}

	if (allGraphics[i].itemLink.filePath == graphicFile) {
		graphicInstances.push(allGraphics[i]);
	}
    }
	
	instancesCount = graphicInstances.length;

	makeDialog();
}

function makeDialog() {
	var w = new Window("dialog", "Batch Layer Visibility 1.4");
	w.alignChildren = ["fill", "fill"];
	checkboxes = [];
	
	var panel = w.add("panel", undefined, "Page x of y");
	panel.alignChildren = ["fill", "fill"];
	
	var panelStack = panel.add("group");
	panelStack.orientation = "stack";
	
	var g_options = graphicInstances[0].graphicLayerOptions;
	var g_layers = graphicInstances[0].graphicLayerOptions.graphicLayers;
	var g_layersCount = g_layers.length;
	
	var layersPerPage = 10;
	var pages2create = (g_layersCount / layersPerPage);
	pages2create = g_layersCount % layersPerPage == 0 ? pages2create : pages2create +1;
	var stackPages = [];
	var curLayer = 0;
	
	for (var p = 0; p < pages2create; p++){
		stackPages.push(panelStack.add("group"));
		stackPages[p].orientation = "column";
		stackPages[p].alignment = ["fill", "top"];
		
		for (var i = 0; i < layersPerPage; i++){
			//curLayer++;
			
			var cb_group = stackPages[p].add("group");
			cb_group.alignment = ["fill", "fill"];
			cb_group.orientation = "row";
			checkboxes.push( cb_group.add("checkbox") );
			
			var cb_label = cb_group.add("statictext", undefined, g_layers[curLayer].name);
			checkboxes[curLayer].value = g_layers[curLayer].currentVisibility;
			
			curLayer++;
			
			if(curLayer > g_layersCount -1){
				break;
			}
		}
		
		if (p == 0){
			stackPages[p].visible = true;
		} else {
			stackPages[p].visible = false;
		}
		
		if(curLayer > g_layersCount -1){
			break;
		}
	}
	
	panel.text = "Page 1 of " + stackPages.length;
	
	var btnsPanel = w.add("group");
	btnsPanel.orientation = "column";
	
	var selectBtns = btnsPanel.add("panel");
	selectBtns.orientation = "row";
	selectBtns.alignment = ["fill", "bottom"];
	selectBtns.alignChildren = ["fill", "fill"];
	selectBtns.orientation = "row";
	
	var selectAllBtn = selectBtns.add("button", undefined, "Select all");
	var invertAllBtn = selectBtns.add("button", undefined, "Invert Selection");
	var deselectAllBtn = selectBtns.add("button", undefined, "Deselect all");
	
	selectAllBtn.onClick = function(){
		for (var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = true;
		}
	}
	
	deselectAllBtn.onClick = function(){
		for(var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = false;
		}
	}
	
	invertAllBtn.onClick = function(){
		for(var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = checkboxes[i].value == true ? false : true;
		}
	}
	
	var pageBtns = btnsPanel.add("panel");
	pageBtns.alignment = ["fill", "bottom"];
	pageBtns.alignChildren = ["fill", "fill"];
	pageBtns.orientation = "row";
	
	var prevBtn = pageBtns.add("button", undefined, "Previous Page");
	var nextBtn = pageBtns.add("button", undefined, "Next Page");
	
	var curPage = 0;
	
	prevBtn.onClick = function(){
		if(curPage == 0){
			return;
		}
		
		stackPages[curPage].visible = false;
		stackPages[curPage -1].visible = true;
		panel.text = "Page " +  (curPage) + " of " + stackPages.length;
		
		if(curPage > 0){
			curPage--;
		}

	}
	
	nextBtn.onClick = function(){
		if(curPage == stackPages.length -1){
			return;
		}
		
		stackPages[curPage].visible = false;
		stackPages[curPage +1].visible = true;
		panel.text = "Page " +  (curPage +2) + " of " + stackPages.length;
		
		if(curPage < stackPages.length -1){
			curPage++;
		}
	}
	
	update_options = [];   
	
	updateOptionsPanel = w.add("panel", undefined, "Link Update Options");
	updateOptionsPanel.alignChildren = ["fill", "fill"];
	update_options[0] = updateOptionsPanel.add("radiobutton", undefined, "PDF Visibility");
	update_options[1] = updateOptionsPanel.add("radiobutton", undefined, "Custom Visibility");   
	
	if (sel.graphicLayerOptions.updateLinkOption.toString() == "APPLICATION_SETTINGS") {
		update_options[0].value = true;
	} else {
		update_options[1].value = true;
	} 
	
	var btnGrp = w.add("group");
	
	btnGrp.orientation = "row";   
	
	var closeBtn = btnGrp.add("button", undefined, "Exit", {name: "cancel"});
	
	closeBtn.onClick = function () {
		w.close();
		exit();
	}   

	var exeBtn = btnGrp.add("button", undefined, "OK", {name: "ok"});
	
	if(w.show() ==1) {
		app.doScript(setVisibility, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.entireScript, "Batch Layer Visibility");
	}
}

function setVisibility() {
	pbar();
	var graphicFile = sel.itemLink.filePath;
	for (var c = 0; c < checkboxes.length; c++) {
		var allGraphics= app.activeDocument.allGraphics;
		
		// seek instances and change visibility
		
		for (var i = 0; i < allGraphics.length; i++) {
			if (allGraphics[i].itemLink == null) {
				continue;
			}
			
			if (allGraphics[i].itemLink.filePath == graphicFile) {
				allGraphics[i].graphicLayerOptions.graphicLayers[c].currentVisibility = checkboxes[c].value;
				pbar_layer.value++;
				pbarText.text = "Layer " + (c+1) + " of " + checkboxes.length; 
			}
		}
	}
	
	allGraphics = app.activeDocument.allGraphics;
	
	// set link update option
	for (var i = 0; i < allGraphics.length; i++) {
		if (allGraphics[i].itemLink == null) {continue;}
		if (allGraphics[i].itemLink.filePath ==graphicFile) {
			if (updateOptionSel = updateOptionsPanel.children[0].value == true) {
				allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.APPLICATION_SETTINGS;
			} else {
				allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.KEEP_OVERRIDES;
			}
			
			pbar_layer.value++;
		}
	}
	
	pbarWindow.close();
}

function setCheckboxStatus() {
	if (ui_layerList.selection.checked == true) {
		ui_layerList.selection.checked = false;
	} else {
		ui_layerList.selection.checked = true;
	}

	var tempSel = ui_layerList.selection;
	ui_layerList.selection = null;
}

function pbar () {

	pbarWindow = new Window ("palette", "Processing ...", undefined);
	var pbarPanel = pbarWindow.add("panel", undefined, undefined);
	pbarText = pbarPanel.add("statictext", undefined, "Progress:");
	pbarText.alignment = ["fill","fill"];
	pbar_layer = pbarPanel.add("progressbar", undefined, 0, (instancesCount * checkboxes.length) + instancesCount);
	pbar_layer.preferredSize.width = 200;
	pbarWindow.show();

}
TOPICS
Scripting

Views

1.7K

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
Jul 15, 2019 0
Most Valuable Participant ,
Jul 16, 2019

Copy link to clipboard

Copied

Try relinking it along with show options.

However, if you want different options for each, you'd probably need a script.

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...
Jul 16, 2019 0
Explorer ,
Jul 16, 2019

Copy link to clipboard

Copied

The issue with that is I need to maintain specific artboard / page links,

if I go that route I think it defaults to the 1st artboard in all

instances.

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...
Jul 16, 2019 0
Most Valuable Participant ,
Jul 16, 2019

Copy link to clipboard

Copied

Right…which is why I pointed that out.

You might want to pop over to the scripting forum and see if anyone can help.

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...
Jul 16, 2019 0
Adobe Employee ,
Jul 18, 2019

Copy link to clipboard

Copied

Hi Aaron,

Thanks for reaching out. As Bob mentioned, this might be possible through scripting. Hence moving the discussion to InDesign Scripting community.

Regards,

Srishti

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...
Jul 18, 2019 0
Explorer ,
Jul 23, 2019

Copy link to clipboard

Copied

Does anyone know how to script something like this?

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...
Jul 23, 2019 0
Participant ,
Jul 23, 2019

Copy link to clipboard

Copied

Hi,

you could try this one

main();

function main() {

var sel = app.selection[0];

if (!sel) {

alert("Nothing selected.");

exit();

}

try {

var test = sel.graphicLayerOptions.graphicLayers;

if (test.length == 0) {

alert("Selected object not supported.");

exit();

}

} catch (err) {

alert("Please select an .AI image with the white selection tool or click in the links panel on the graphic.");

exit();

}

var graphicFile = sel.itemLink.filePath;

instances = new Array();

var allGraphics= app.activeDocument.allGraphics;

// collect instances

for (var i = 0; i < allGraphics.length; i++) {

if (allGraphics.itemLink.filePath == graphicFile) {

instances.push(allGraphics);

}

}

makeWindow();

}

function makeWindow() {

var w = new Window("dialog", "Batch Layer Visibility");

w.alignChildren = ["fill", "fill"];

checkboxes = new Array();

var panel = w.add("panel", undefined, "Layer Visibility");

panel.alignChildren = ["fill", "fill"];

for (var i = 0; i < instances[0].graphicLayerOptions.graphicLayers.length; i++) {

checkboxes = panel.add("checkbox");

checkboxes.text = instances[0].graphicLayerOptions.graphicLayers.name;

checkboxes.value = instances[0].graphicLayerOptions.graphicLayers.currentVisibility;

}

update_options = new Array();

updateOptionsPanel = w.add("panel", undefined, "Link Update Options");

updateOptionsPanel.alignChildren = ["fill", "fill"];

update_options[0] = updateOptionsPanel.add("radiobutton", undefined, "PDF Visibility");

update_options[1] = updateOptionsPanel.add("radiobutton", undefined, "Custom Visibility");

if (app.selection[0].graphicLayerOptions.updateLinkOption.toString() == "APPLICATION_SETTINGS") {

update_options[0].value = true;

} else {update_options[1].value = true;}

var btnGrp = w.add("group");

btnGrp.orientation = "row";

var closeBtn = btnGrp.add("button", undefined, "Exit");

closeBtn.onClick = function () {

proceed = false;

w.close();

exit();

}

var exeBtn = btnGrp.add("button", undefined, "OK", {name: "ok"});

exeBtn.onClick = function() {

proceed = true;

w.close();

}

w.show();

}

if (proceed == true) {

app.doScript(setVisibility, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.entireScript, "Batch Layer Visibility");

}

function setVisibility() {

var graphicFile = app.selection[0].itemLink.filePath;

for (var c = 0; c < checkboxes.length; c++) {

var allGraphics= app.activeDocument.allGraphics;

// collect instances

for (var i = 0; i < allGraphics.length; i++) {

if (allGraphics.itemLink.filePath == graphicFile) {

allGraphics.graphicLayerOptions.graphicLayers.currentVisibility = checkboxes.value;

}

}

}

allGraphics = app.activeDocument.allGraphics;

for (var i = 0; i < allGraphics.length; i++) {

if (allGraphics.itemLink.filePath ==graphicFile) {

if (updateOptionSel = updateOptionsPanel.children[0].value == true) {

allGraphics.graphicLayerOptions.updateLinkOption = UpdateLinkOptions.APPLICATION_SETTINGS;

} else {

allGraphics.graphicLayerOptions.updateLinkOption = UpdateLinkOptions.KEEP_OVERRIDES;

}

}

}

}

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...
Jul 23, 2019 1
Adobe Community Professional ,
Jul 24, 2019

Copy link to clipboard

Copied

Hi crazyPanda ,

if something goes wrong with currentVisibility and the loop through the allGraphics array read into this here:

Re: Place specific pdf layer into indesign with javascript

Note: Changing the value of currentVisibility of graphicLayer will change the ID of the placed graphic.

Old bug.

Regards,
Uwe

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...
Jul 24, 2019 1
Explorer ,
Jul 24, 2019

Copy link to clipboard

Copied

Oh my gosh! Thank you!!!! I Have been trying to figure this out for months!!!! I think this works... You rock!

@laubender, I am not really too familiar with javascript (just learning). Is this something that I need to fix within @crazypanda 's script?

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...
Jul 24, 2019 0
Adobe Community Professional ,
Jul 24, 2019

Copy link to clipboard

Copied

If you see no issue and all is working as expected: no.

Do not change anything.

If you want to do more with currentVisibility read into the linked thread above.

Also in this one: Activating object layers basing on document layers

Regards,
Uwe

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...
Jul 24, 2019 1
Participant ,
Jul 24, 2019

Copy link to clipboard

Copied

Hi Laubender,

I actually ran into this problem when I wrote that script yesterday. I almost would have given up because of that. But I guess the work around for this script will work just fine.

It gets all instances of the graphic based on its filepath. Then it changes the visibility of the first layer of the first instance, moves on to the second instance and changes the visibility of the first layer, moves on to the third instance ... and so on. After processing the last instance it starts all over again: collect all instances again, change the visibility of the second layer of the first instance, moves on the the second instance... and so on.

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...
Jul 24, 2019 2
Adobe Community Professional ,
Jul 24, 2019

Copy link to clipboard

Copied

crazyPanda  wrote

Hi Laubender ,

I actually ran into this problem when I wrote that script yesterday. I almost would have given up because of that. But I guess the work around for this script will work just fine. …

Hi

I did a bug report on this at Adobe InDesign UserVoice:

Scripting | graphicLayerOptions : Changing visibility of graphicLayer will change ID number of place...

If you did not do it, please vote for fixing the bug 🙂

Regards,
Uwe

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...
Jul 24, 2019 0
Explorer ,
Jul 24, 2019

Copy link to clipboard

Copied

Hi crazyPanda​,

Would it be possible to add a vertical scroll bar to the dialogue box? In some cases I have more layers than are fitting on the screen...

Also, it seems to be working fine.. but is there something that Labender referenced that needs to be addressed? I am not really following what exactly the issues is... 

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...
Jul 24, 2019 0
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

Hi aaronf31067511 ,

read into my bug report to understand a bit of the issue and do some tests with:

1. Placed InDesign Page with some layers

2. Placed PDF page with some layers

3. Placed AI artboard with some layers

4. Placed PSD with some layers

crazyPanda did a workaround of the bug. So no worry.

Regards,
Uwe

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...
Jul 25, 2019 1
Participant ,
Jul 25, 2019

Copy link to clipboard

Copied

aaronf31067511

Regarding a scrollbar I'll try to find a solution when I'm back home.

Regarding that bug there's nothing to worry about.

Laubender

I've upvoted that bug report.

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...
Jul 25, 2019 3
Explorer ,
Jul 25, 2019

Copy link to clipboard

Copied

@crazyPanda Thank you so much!!

If it helps.. I have seen it approached like the attached script for Illustrator with tabbed panels (rather than a scroll bar, although not as clean).

Laubender​  I have also upvoted. Thank you for the guidance here. 

//

//     LAYER RENAMER

//    Simple way to rename multiple layers

//     Including addition of prefix's and suffix's.

//

//    Author: Qwertyfly

//    Contact: tristan@qwertyfly.com

//

//    Version 1.001 - 02/3/17

//

//     Change Log:

//     V1.001 - large overhaul

//                     Including addition of Pages to deal with large layer counts

//                     and selectall checkboxes.

//                     Code is still a mess, needs to be cleaned up...,

//    

//

// All code within this script is the property of Tristan O'Brien.

// This script is free for personal use

// Permission is required prior to any commercial application.

//

//  any suggestions? drop me a line...

//

// -------- User Variable ----------

var numberOfLayersPerPage = 10;

//---------------------------------------

layerRenamer();

function layerRenamer(){

    var doc = app.activeDocument, lays = [];

   

    for(var i = 0; i < doc.layers.length; i++){ 

        lays.push(doc.layers.name); 

    }

    var layerQty = lays.length;

    var currentPage = 1;

    var rangeS = 1;

    var rangeE = 10;

    var pageQty = Math.ceil(layerQty/numberOfLayersPerPage);

    var page = [];

   

    var w = new Window('dialog',"Layer Name Editor"); 

    var list = w.add('group'); 

    list.orientation = "Column"; 

   

    var s, n, p, head;

    var  pre = [], nam = [], suf = [];

   

    var tabs = list.add ("tabbedpanel");

    tabs.alignChildren = ["fill", "fill"];

    tabs.preferredSize = [280,300];

   

    for(var j = 0; j < pageQty;j++){

        if(currentPage === pageQty){

            rangeE = layerQty;

        }

        page[currentPage] = tabs.add('tab',undefined,rangeS + " - " + rangeE);

       

//now add lines.

        addHead(page[currentPage]);

        for(var i = rangeS-1; i < rangeE; i++){ 

            newLine(i,"item" + i,page[currentPage]); 

        }

   

        rangeS = rangeS + 10;

        rangeE = rangeE + 10;

        currentPage++

    }

   

   

   

function addHead(currentPage){ 

    head = currentPage.add('group'); 

    head.alignment = "left"; 

    p = head.add('statictext', undefined, "Prefix"); 

    n = head.add('statictext', [0,0,165,20], "            Layer Name"); 

    s = head.add('statictext', undefined, "Suffix"); 

}   

   

   

     

    function newLine(num,item,currentPage){ 

        item = currentPage.add('group'); 

        item.alignment = "left"; 

        pre[num] = item.add('checkbox', undefined,""); 

        nam[num] = item.add('edittext', [0,0,200,20], lays); 

        nam[num].characters = 50; 

        suf[num] = item.add('checkbox', undefined, ""); 

    } 

    selectAll();

    function selectAll(){

         var selAll =  list.add('group');

         selAll.alignment = ["fill","fill"];

         var preAll = selAll.add('checkbox',undefined,"");

         var AllText = selAll.add('statictext',[0,0,230,20],"       <-------      Select All      ------->");

         var postAll = selAll.add('checkbox',undefined,"");

         preAll.onClick = function(){checkAll(pre,preAll.value)};

         postAll.onClick = function(){checkAll(suf,postAll.value)};

    }

    function checkAll(checkboxArray,Value){

        var checked = false;

        if(Value === true){

            checked = true;

        }

        for(var k = 0;k < checkboxArray.length ; k++){

            checkboxArray.value = checked;

        }

    }

    var sep1 = list.add("panel"); 

    sep1.alignment = ["fill","fill"]; 

    sep1.minimumSize.height = sep1.maximumSize.height = 2; 

    var prefixt = list.add('statictext', undefined, "Prefix to add to checked layers"); 

    var prefix = list.add('edittext', [0,0,250,20], ""); 

    var sep2 = list.add("panel"); 

    sep2.alignment = ["fill","fill"]; 

    sep2.minimumSize.height = sep2.maximumSize.height = 2; 

    var prefixt = list.add('statictext', undefined, "Suffix to add to checked layers"); 

    var suffix = list.add('edittext', [0,0,250,20], ""); 

    var sep3 = list.add("panel"); 

    sep3.alignment = ["fill","fill"]; 

    sep3.minimumSize.height = sep3.maximumSize.height = 2; 

    var ButtonGroup = w.add("group"); 

      ButtonGroup.margins = [0,-10,0,-8]; 

      ButtonGroup.alignment = "right"; 

      var go = ButtonGroup.add ("button", undefined, "OK"); 

      var stop = ButtonGroup.add ("button", undefined, "Cancel"); 

      stop.onClick = function(){ 

      w.close(); 

      } 

        go.onClick = function(){ 

            var validatePre = false, validateSuf = false, validateMessage = ""; 

            for(var i = 0; i < lays.length; i++){ 

                if(pre.value == true && prefix.text == ""){validatePre = true} 

                if(suf.value == true && suffix.text == ""){validateSuf = true} 

            } 

            if(validatePre == true){validateMessage = "Layers have been marked for Prefix, but no Prefix entered\n"} 

            if(validateSuf == true){validateMessage = validateMessage + "Layers have been marked for Suffix, but no Suffix entered"} 

            if(validateMessage != ""){ 

                alert(validateMessage); 

            }else{ 

                w.close(); 

                goTime(); 

            } 

      } 

    w.show();

     

     

    function goTime(){ 

        for(var i = 0; i < lays.length; i++){ 

            var na = nam.text; 

            var pr = ""; 

            var su = ""; 

            if(pre.value == true){pr = prefix.text + " - "} 

            if(suf.value == true){su = " - " + suffix.text} 

            doc.layers.name = pr + na + su; 

        } 

    }

}

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...
Jul 25, 2019 0
Participant ,
Jul 25, 2019

Copy link to clipboard

Copied

So this is what it looks like now: All layers are now listed in a scrollable list.

scrollable list.png

While trying to change to visibility of more than one layer it occured to me that a progressbar might be a nice addition because I couldn't tell whether Indesign had frozen or if it was still running that script.

progressbar.png

So here's the new version:

#targetengine batchLayerVisibility

main();

function main() {

proceed = false;

if (app.selection.length == 0) {

alert("Nothing selected.");

exit();

}

var sel = app.selection[0];

try {

var test = sel.graphicLayerOptions.graphicLayers;

if (test.length == 0) {

alert("Selected object not supported.");

exit();

}

} catch (err) {

alert("Please select an .AI image with the white selection tool or click in the links panel on the graphic.");

exit();

}

var graphicFile = sel.itemLink.filePath;

instances = new Array();

var allGraphics= app.activeDocument.allGraphics;

// collect instances

for (var i = 0; i < allGraphics.length; i++) {

if (allGraphics.itemLink.filePath == graphicFile) {

instances.push(allGraphics);

}

}

instancesCount = instances.length;

makeWindow();

}

function makeWindow() {

var w = new Window("dialog", "Batch Layer Visibility 1.1");

w.alignChildren = ["fill", "fill"];

checkboxes = new Array();

var panel = w.add("panel", undefined, "Layer Visibility");

panel.alignChildren = ["fill", "fill"];

layerList = panel.add("listbox", [0, 0, 400, 500], undefined, {multiselect: false, scrolling: true});

for (var i = 0; i < instances[0].graphicLayerOptions.graphicLayers.length; i++) {

var tempItem = layerList.add("item", instances[0].graphicLayerOptions.graphicLayers.name);

tempItem.checked = instances[0].graphicLayerOptions.graphicLayers.currentVisibility;

//tempItem.onClick = function () {alert();}

}

layerList.onChange =setCheckboxStatus; // call function setCheckboxStatus

checkboxes = layerList.items;

update_options = new Array();

updateOptionsPanel = w.add("panel", undefined, "Link Update Options");

updateOptionsPanel.alignChildren = ["fill", "fill"];

update_options[0] = updateOptionsPanel.add("radiobutton", undefined, "PDF Visibility");

update_options[1] = updateOptionsPanel.add("radiobutton", undefined, "Custom Visibility");

if (app.selection[0].graphicLayerOptions.updateLinkOption.toString() == "APPLICATION_SETTINGS") {

update_options[0].value = true;

} else {update_options[1].value = true;}

var btnGrp = w.add("group");

btnGrp.orientation = "row";

var closeBtn = btnGrp.add("button", undefined, "Exit");

closeBtn.onClick = function () {

proceed = false;

w.close();

exit();

}

var exeBtn = btnGrp.add("button", undefined, "OK", {name: "ok"});

exeBtn.onClick = function() {

proceed = true;

w.close();

}

w.show();

}

if (proceed == true) {

app.doScript(setVisibility, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.entireScript, "Batch Layer Visibility");

}

function setVisibility() {

pbar();

var graphicFile = app.selection[0].itemLink.filePath;

for (var c = 0; c < checkboxes.length; c++) {

var allGraphics= app.activeDocument.allGraphics;

// seek instances and change visibility

for (var i = 0; i < allGraphics.length; i++) {

if (allGraphics.itemLink.filePath == graphicFile) {

//pbar_instance.value++;

allGraphics.graphicLayerOptions.graphicLayers.currentVisibility = checkboxes.checked;

pbar_layer.value++;

}

}

}

allGraphics = app.activeDocument.allGraphics;

// set link update option

for (var i = 0; i < allGraphics.length; i++) {

if (allGraphics.itemLink.filePath ==graphicFile) {

if (updateOptionSel = updateOptionsPanel.children[0].value == true) {

allGraphics.graphicLayerOptions.updateLinkOption = UpdateLinkOptions.APPLICATION_SETTINGS;

} else {

allGraphics.graphicLayerOptions.updateLinkOption = UpdateLinkOptions.KEEP_OVERRIDES;

}

pbar_layer.value++;

}

}

pbarWindow.close();

}

function setCheckboxStatus() {

if (layerList.selection.checked == true) {

layerList.selection.checked = false;

} else {layerList.selection.checked = true;}

var tempSel = layerList.selection;

layerList.selection = null;

}

function pbar () {

pbarWindow = new Window ("palette", "Processing ...", undefined);

pbarPanel = pbarWindow.add("panel");

//pbarPanel.add("statictext", undefined, "Instances");

//pbar_instance = pbarPanel.add("progressbar", undefined, 0, instancesCount);

pbarPanel.add("statictext", undefined, "Progress:");

pbar_layer = pbarPanel.add("progressbar", undefined, 0, (instancesCount * checkboxes.length) + instancesCount);

pbar_layer.preferredSize.width = 200;

pbarWindow.show();

}

If you want to modify the size of the window change the third and forth number within the brackets in line 55:

layerList = panel.add("listbox", [0, 0, 400, 500], undefined, {multiselect: false, scrolling: true});

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...
Jul 25, 2019 2
Explorer ,
Jul 25, 2019

Copy link to clipboard

Copied

Wow this is perfect!

One little bug.. If you scroll down to the bottom of the list then scroll back up, the layers that were beyond the scroll window lose the check box. They come back if you click on the layer so it doesn't effect the function.. just a little bug.  See layers at top, these were beyond the scroll window.

Screen Shot 2019-07-25 at 3.16.18 PM.png

I can't thank you enough! This will save me hours of work!

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...
Jul 25, 2019 0
Participant ,
Jul 26, 2019

Copy link to clipboard

Copied

Hi aaronf31067511​,

I assume you work on a Mac? The script window is programmed in ScriptUI. From my experience such interfaces work fine on Windows but on Mac sometimes they seem buggy.

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...
Jul 26, 2019 0
Explorer ,
Jul 26, 2019

Copy link to clipboard

Copied

ahhh.. yes, on a mac (code pasted into Adobe ExtendScript Toolkit).

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...
Jul 26, 2019 0
Explorer ,
Aug 12, 2019

Copy link to clipboard

Copied

@crazyPanda

I'm not sure what happened but I started getting an error (I have not updated InDesign so not sure what is going on). Are you able to help, please please

Screen Shot 2019-08-12 at 11.24.17 AM.png

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...
Aug 12, 2019 0
Adobe Community Professional ,
Aug 12, 2019

Copy link to clipboard

Copied

Hi aaronf31067511 ,

are there some graphics that are not placed and linked?

Maybe copied and pasted from PhotoShop directly?

Or are there some placed graphics that were embedded into the InDesign document?

Regards,
Uwe

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...
Aug 12, 2019 0
Explorer ,
Aug 12, 2019

Copy link to clipboard

Copied

Hi Laubender​,

Nope, this is a placed Illustrator file... I have tried the script on a few different files with the same error result

Screen Shot 2019-08-12 at 11.39.42 AM.png

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...
Aug 12, 2019 0
Participant ,
Aug 12, 2019

Copy link to clipboard

Copied

Hi,

I can only assume that there is a graphic in the document that is neither linked nor embedded. We had a similiar problem with a different script that we use at work.

I modified the script so that it will ignore these graphics by adding the line

if (allGraphics.itemLink == null) {continue;}

#targetengine batchLayerVisibility

main();

function main() {

    proceed = false;

  

    if (app.selection.length == 0) {

        alert("Nothing selected.");

        exit();

    }

    var sel = app.selection[0];

  

    try {

        var test = sel.graphicLayerOptions.graphicLayers;

        if (test.length == 0) {

            alert("Selected object not supported.");

            exit();

        }

        } catch (err) {

            alert("Please select an .AI image with the white selection tool or click in the links panel on the graphic.");

            exit();

        }

  

    var graphicFile = sel.itemLink.filePath;

    instances = new Array();

    var allGraphics= app.activeDocument.allGraphics;

  

    // collect instances

    for (var i = 0; i < allGraphics.length; i++) {

        if (allGraphics.itemLink == null) {continue;}

        if (allGraphics.itemLink.filePath == graphicFile) {

            instances.push(allGraphics);

        }

    }

    instancesCount = instances.length;

  

    makeWindow();

}

function makeWindow() {

    var w = new Window("dialog", "Batch Layer Visibility 1.2");

    w.alignChildren = ["fill", "fill"];

    checkboxes = new Array();

  

    var panel = w.add("panel", undefined, "Layer Visibility");

    panel.alignChildren = ["fill", "fill"];

  

    layerList = panel.add("listbox", [0, 0, 400, 500], undefined, {multiselect: false, scrolling: true});

  

    for (var i = 0; i < instances[0].graphicLayerOptions.graphicLayers.length; i++) {

        var tempItem = layerList.add("item", instances[0].graphicLayerOptions.graphicLayers.name);

        tempItem.checked = instances[0].graphicLayerOptions.graphicLayers.currentVisibility;

        //tempItem.onClick = function () {alert();}

    }

    layerList.onChange =setCheckboxStatus; // call function setCheckboxStatus

  

    checkboxes = layerList.items;

  

    update_options = new Array();

  

    updateOptionsPanel = w.add("panel", undefined, "Link Update Options");

    updateOptionsPanel.alignChildren = ["fill", "fill"];

    update_options[0] = updateOptionsPanel.add("radiobutton", undefined, "PDF Visibility");

    update_options[1] = updateOptionsPanel.add("radiobutton", undefined, "Custom Visibility");

  

    if (app.selection[0].graphicLayerOptions.updateLinkOption.toString() == "APPLICATION_SETTINGS") {

        update_options[0].value = true;

    } else {update_options[1].value = true;}

  

    var btnGrp = w.add("group");

    btnGrp.orientation = "row";

  

    var closeBtn = btnGrp.add("button", undefined, "Exit");

    closeBtn.onClick = function () {

        proceed = false;

        w.close();

        exit();

    }

  

    var exeBtn = btnGrp.add("button", undefined, "OK", {name: "ok"});

    exeBtn.onClick = function() {

        proceed = true;

        w.close();

    }

  

    w.show();

}

if (proceed == true) {

    app.doScript(setVisibility, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.entireScript, "Batch Layer Visibility");

}

function setVisibility() {

    pbar();

  

    var graphicFile = app.selection[0].itemLink.filePath;

  

    for (var c = 0; c < checkboxes.length; c++) {

      

        var allGraphics= app.activeDocument.allGraphics;

      

        // seek instances and change visibility

        for (var i = 0; i < allGraphics.length; i++) {

            if (allGraphics.itemLink == null) {continue;}

            if (allGraphics.itemLink.filePath == graphicFile) {

              

                //pbar_instance.value++;

              

                allGraphics.graphicLayerOptions.graphicLayers.currentVisibility = checkboxes.checked;

              

                pbar_layer.value++;

            }

        }

    }

    allGraphics = app.activeDocument.allGraphics;

  

    // set link update option

    for (var i = 0; i < allGraphics.length; i++) {

        if (allGraphics.itemLink == null) {continue;}

        if (allGraphics.itemLink.filePath ==graphicFile) {

            if (updateOptionSel = updateOptionsPanel.children[0].value == true) {

                allGraphics.graphicLayerOptions.updateLinkOption = UpdateLinkOptions.APPLICATION_SETTINGS;

            } else {

                allGraphics.graphicLayerOptions.updateLinkOption = UpdateLinkOptions.KEEP_OVERRIDES;

            }

            pbar_layer.value++;

        }

    }

  

    pbarWindow.close();

  

}

function setCheckboxStatus() {

  

    if (layerList.selection.checked == true) {

        layerList.selection.checked = false;

    } else {layerList.selection.checked = true;}

    var tempSel = layerList.selection;

    layerList.selection = null;

}

function pbar () {

    pbarWindow = new Window ("palette", "Processing ...", undefined);

    pbarPanel = pbarWindow.add("panel");

  

    //pbarPanel.add("statictext", undefined, "Instances");

    //pbar_instance = pbarPanel.add("progressbar", undefined, 0, instancesCount);

  

    pbarPanel.add("statictext", undefined, "Progress:");

    pbar_layer = pbarPanel.add("progressbar", undefined, 0, (instancesCount * checkboxes.length) + instancesCount);

    pbar_layer.preferredSize.width = 200;

  

    pbarWindow.show();

  

}

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...
Aug 12, 2019 1
Explorer ,
Aug 13, 2019

Copy link to clipboard

Copied

crazyPanda You are a mad scientist genius!!! Thank you!! 

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...
Aug 13, 2019 0
Explorer ,
Feb 05, 2020

Copy link to clipboard

Copied

@crazyPanda

The script seems to have broken with upgrade to InDesign 2020... Any thoughts on how to fix? This script has become my go-to tool!! Help would be incredibly appreciated! 

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...
Feb 05, 2020 0
Adobe Community Professional ,
Feb 06, 2020

Copy link to clipboard

Copied

Hi aaronf31067511,

what's the exact error message you get?

 

Did you save the code back in July 2019 to a script file?
And are you using the same script file from back then with InDesign 2020?

 

If not, because you copied the code by the end of last year or this year and made a new script file, the reason why the code is broken is: The code was damaged while this thread was moved to the new Adobe InDesign forum.

 

Then we could only hope that crazyPanda stops by and corrects the code in his post or posts the not damaged code again.

 

I'm 100% sure that the code you can read and copy right now as I am writing this reply is damaged.

 

Regards,
Uwe Laubender

( ACP )

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...
Feb 06, 2020 0
Explorer ,
Feb 06, 2020

Copy link to clipboard

Copied

Thanks @Uwe,

Hopefully crazyPanda or someone is able to help! I'm still learning 🙂 

 

Yes using exactly the same script file with the new Adobe Indesign 2020... No error message.. the script doesn't seem "broken," as in it still runs, but the check boxes for the layers are no longer showing... 

 

InDesign 2020 (missing check boxes):

InDesign 2020InDesign 2020

 

 

InDesign 2019 (check boxes showing): 

 

 

InDesign 2019InDesign 2019

 

Original Script that worked with 2019

#targetengine batchLayerVisibility  
  
main();  
  
function main() {  
    proceed = false;  
     
    if (app.selection.length == 0) {  
        alert("Nothing selected.");  
        exit();  
    }  
  
    var sel = app.selection[0];  
     
    try {  
        var test = sel.graphicLayerOptions.graphicLayers;  
        if (test.length == 0) {  
            alert("Selected object not supported.");  
            exit();  
        }  
        } catch (err) {  
            alert("Please select an .AI image with the white selection tool or click in the links panel on the graphic.");  
            exit();  
        }  
     
    var graphicFile = sel.itemLink.filePath;  
    instances = new Array();  
    var allGraphics= app.activeDocument.allGraphics;  
     
    // collect instances  
    for (var i = 0; i < allGraphics.length; i++) {  
        if (allGraphics[i].itemLink == null) {continue;}  
        if (allGraphics[i].itemLink.filePath == graphicFile) {  
            instances.push(allGraphics[i]);  
        }  
    }  
  
    instancesCount = instances.length;  
     
    makeWindow();  
}  
  
function makeWindow() {  
    var w = new Window("dialog", "Batch Layer Visibility 1.2");  
    w.alignChildren = ["fill", "fill"];  
    checkboxes = new Array();  
     
    var panel = w.add("panel", undefined, "Layer Visibility");  
    panel.alignChildren = ["fill", "fill"];  
     
    layerList = panel.add("listbox", [0, 0, 400, 500], undefined, {multiselect: false, scrolling: true});  
     
    for (var i = 0; i < instances[0].graphicLayerOptions.graphicLayers.length; i++) {  
        var tempItem = layerList.add("item", instances[0].graphicLayerOptions.graphicLayers[i].name);  
        tempItem.checked = instances[0].graphicLayerOptions.graphicLayers[i].currentVisibility;  
        //tempItem.onClick = function () {alert();}  
    }  
  
    layerList.onChange =setCheckboxStatus; // call function setCheckboxStatus  
     
    checkboxes = layerList.items;  
     
    update_options = new Array();  
     
    updateOptionsPanel = w.add("panel", undefined, "Link Update Options");  
    updateOptionsPanel.alignChildren = ["fill", "fill"];  
    update_options[0] = updateOptionsPanel.add("radiobutton", undefined, "PDF Visibility");  
    update_options[1] = updateOptionsPanel.add("radiobutton", undefined, "Custom Visibility");  
     
    if (app.selection[0].graphicLayerOptions.updateLinkOption.toString() == "APPLICATION_SETTINGS") {  
        update_options[0].value = true;  
    } else {update_options[1].value = true;}  
     
    var btnGrp = w.add("group");  
    btnGrp.orientation = "row";  
     
    var closeBtn = btnGrp.add("button", undefined, "Exit");  
    closeBtn.onClick = function () {  
        proceed = false;  
        w.close();  
        exit();  
    }  
     
    var exeBtn = btnGrp.add("button", undefined, "OK", {name: "ok"});  
    exeBtn.onClick = function() {  
        proceed = true;  
        w.close();  
    }  
     
    w.show();  
}  
  
if (proceed == true) {  
    app.doScript(setVisibility, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.entireScript, "Batch Layer Visibility");  
}  
  
function setVisibility() {  
    pbar();  
     
    var graphicFile = app.selection[0].itemLink.filePath;  
     
    for (var c = 0; c < checkboxes.length; c++) {  
         
        var allGraphics= app.activeDocument.allGraphics;  
         
        // seek instances and change visibility  
        for (var i = 0; i < allGraphics.length; i++) {  
            if (allGraphics[i].itemLink == null) {continue;}  
            if (allGraphics[i].itemLink.filePath == graphicFile) {  
                 
                //pbar_instance.value++;  
                 
                allGraphics[i].graphicLayerOptions.graphicLayers[c].currentVisibility = checkboxes[c].checked;  
                 
                pbar_layer.value++;  
            }  
        }  
    }  
  
    allGraphics = app.activeDocument.allGraphics;  
     
    // set link update option  
    for (var i = 0; i < allGraphics.length; i++) {  
        if (allGraphics[i].itemLink == null) {continue;}  
        if (allGraphics[i].itemLink.filePath ==graphicFile) {  
            if (updateOptionSel = updateOptionsPanel.children[0].value == true) {  
                allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.APPLICATION_SETTINGS;  
            } else {  
                allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.KEEP_OVERRIDES;  
            }  
            pbar_layer.value++;  
        }  
    }  
     
    pbarWindow.close();  
     
}  
  
function setCheckboxStatus() {  
     
    if (layerList.selection.checked == true) {  
        layerList.selection.checked = false;  
    } else {layerList.selection.checked = true;}  
    var tempSel = layerList.selection;  
    layerList.selection = null;  
  
}  
  
function pbar () {  
    pbarWindow = new Window ("palette", "Processing ...", undefined);  
    pbarPanel = pbarWindow.add("panel");  
     
    //pbarPanel.add("statictext", undefined, "Instances");  
    //pbar_instance = pbarPanel.add("progressbar", undefined, 0, instancesCount);  
     
    pbarPanel.add("statictext", undefined, "Progress:");  
    pbar_layer = pbarPanel.add("progressbar", undefined, 0, (instancesCount * checkboxes.length) + instancesCount);  
    pbar_layer.preferredSize.width = 200;  
     
    pbarWindow.show();  
     
}  

 

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...
Feb 06, 2020 0
Adobe Community Professional ,
Feb 06, 2020

Copy link to clipboard

Copied

Checkboxes not showing?

Ah. I see. Well, that could be a new bug with InDesign 2020 in the ScriptUI component.

Don't think that crazyPanda can do something about it.

Other than revising the code completely.

 

Regards,
Uwe Laubender

( ACP )

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...
Feb 06, 2020 0
Adobe Community Professional ,
Feb 06, 2020

Copy link to clipboard

Copied

Ok. Found the thread that I had in mind. It is indeed a new bug with InDesign 2020:

https://community.adobe.com/t5/indesign/listitem-checked-on-indesign-15-0-2020/m-p/10734040#M160426

 

Here some code by mirco1981 for testing CC 2019 vs 2020:

 

#targetengine checkbox-test

var x = new Window ("dialog","test win", [0,0,150,150])
var y = x.add("listbox",[10,10,140,116])
for (var i=0;i<5;i++) {
y.add("item", "test " + i)

// this is the problem... on object model i can find this property but checkmark are not show...
y.items[i].checked = true
}
x.center()
x.show()

 

Regards,
Uwe Laubender

( ACP )

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...
Feb 06, 2020 0
Explorer ,
Feb 07, 2020

Copy link to clipboard

Copied

Uwe,

Is this an easy modification or does this require extensive re-write? 

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...
Feb 07, 2020 0
Adobe Community Professional ,
Feb 10, 2020

Copy link to clipboard

Copied

aaronf31067511 said: Is this an easy modification or does this require extensive re-write?

 

I cannot speak for crazyPanda, but I think the UI part needs an extensive re-write to work around the bug.

 

Regards,
Uwe Laubender

( ACP )

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...
Feb 10, 2020 1
Explorer ,
Feb 26, 2020

Copy link to clipboard

Copied

Uwe,
Would you be willing to help with a rewrite? Looks like @crazyPanda is off
the radar.

Best,
Aaron

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...
Feb 26, 2020 0
Participant ,
Mar 04, 2020

Copy link to clipboard

Copied

Hi,

here's a version with a modified interface with "real" checkboxes. The graphic layers will now be listed on several pages in the interface. Currently 10 layers per page will be shown. If you want a different number per page, change the value of the variable layersPerPage.

Edit: I wrote this on a Windows 10 notebook with ID 14.0.3 so I don't know if there will be problems with the latest ID version or Mac OS.

sample.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

#targetengine "batchLayerVisibility"

var graphicInstances = null, instancesCount = null, checkboxes = null, ui_layerList = null, sel = null, pbarWindow = null;

main();

function main() {

	proceed = false;

	if (app.selection.length == 0) {
		alert("Nothing selected.");
		exit();
	}

	sel = app.selection[0];
	
	sel = sel instanceof PDF ? sel : sel.graphics[0];
	try {
		var test = sel.graphicLayerOptions.graphicLayers;

		if (test.length == 0) {
			alert("Selected object not supported.");
			exit();
		}

		} catch (err) {
			alert("Please select an .AI image with the white selection tool or click in the links panel on the graphic.");
			
			exit();
		}
		
		var graphicFile = sel.itemLink.filePath;

		graphicInstances = [];

		var allGraphics= app.activeDocument.allGraphics;

    // collect instances

    for (var i = 0; i < allGraphics.length; i++) {

	if (allGraphics[i].itemLink == null) {
		continue;
	}

	if (allGraphics[i].itemLink.filePath == graphicFile) {
		graphicInstances.push(allGraphics[i]);
	}
    }
	
	instancesCount = graphicInstances.length;

	makeDialog();
}

function makeDialog() {
	var w = new Window("dialog", "Batch Layer Visibility 1.3");
	w.alignChildren = ["fill", "fill"];
	checkboxes = [];
	
	var panel = w.add("panel", undefined, "Page x of y");
	panel.alignChildren = ["fill", "fill"];
	
	var panelStack = panel.add("group");
	panelStack.orientation = "stack";
	
	var g_options = graphicInstances[0].graphicLayerOptions;
	var g_layers = graphicInstances[0].graphicLayerOptions.graphicLayers;
	var g_layersCount = g_layers.length;
	
	var layersPerPage = 10;
	var pages2create = (g_layersCount / layersPerPage);
	pages2create = g_layersCount % layersPerPage == 0 ? pages2create : pages2create +1;
	var stackPages = [];
	var curLayer = 0;
	
	for (var p = 0; p < pages2create; p++){
		stackPages.push(panelStack.add("group"));
		stackPages[p].orientation = "column";
		stackPages[p].alignment = ["fill", "top"];
		
		for (var i = 0; i < layersPerPage; i++){
			//curLayer++;
			
			var cb_group = stackPages[p].add("group");
			cb_group.alignment = ["fill", "fill"];
			cb_group.orientation = "row";
			checkboxes.push( cb_group.add("checkbox") );
			
			var cb_label = cb_group.add("statictext", undefined, g_layers[curLayer].name);
			checkboxes[curLayer].value = g_layers[curLayer].currentVisibility;
			
			curLayer++;
			
			if(curLayer > g_layersCount -1){
				break;
			}
		}
		
		if (p == 0){
			stackPages[p].visible = true;
		} else {
			stackPages[p].visible = false;
		}
		
		if(curLayer > g_layersCount -1){
			break;
		}
	}
	
	panel.text = "Page 1 of " + stackPages.length;
	
	var pageBtns = panel.add("group");
	pageBtns.alignment = ["fill", "bottom"];
	
	var prevBtn = pageBtns.add("button", undefined, "Previous Page");
	var nextBtn = pageBtns.add("button", undefined, "Next Page");
	
	var curPage = 0;
	
	prevBtn.onClick = function(){
		if(curPage == 0){
			return;
		}
		
		stackPages[curPage].visible = false;
		stackPages[curPage -1].visible = true;
		panel.text = "Page " +  (curPage) + " of " + stackPages.length;
		
		if(curPage > 0){
			curPage--;
		}

	}
	
	nextBtn.onClick = function(){
		if(curPage == stackPages.length -1){
			return;
		}
		
		stackPages[curPage].visible = false;
		stackPages[curPage +1].visible = true;
		panel.text = "Page " +  (curPage +2) + " of " + stackPages.length;
		
		if(curPage < stackPages.length -1){
			curPage++;
		}
	}
	
	update_options = [];   
	
	updateOptionsPanel = w.add("panel", undefined, "Link Update Options");
	updateOptionsPanel.alignChildren = ["fill", "fill"];
	update_options[0] = updateOptionsPanel.add("radiobutton", undefined, "PDF Visibility");
	update_options[1] = updateOptionsPanel.add("radiobutton", undefined, "Custom Visibility");   
	
	if (sel.graphicLayerOptions.updateLinkOption.toString() == "APPLICATION_SETTINGS") {
		update_options[0].value = true;
	} else {
		update_options[1].value = true;
	} 
	
	var btnGrp = w.add("group");
	
	btnGrp.orientation = "row";   
	
	var closeBtn = btnGrp.add("button", undefined, "Exit", {name: "cancel"});
	
	closeBtn.onClick = function () {
		w.close();
		exit();
	}   

	var exeBtn = btnGrp.add("button", undefined, "OK", {name: "ok"});
	
	if(w.show() ==1) {
		app.doScript(setVisibility, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.entireScript, "Batch Layer Visibility");
	}
}

function setVisibility() {
	pbar();
	var graphicFile = sel.itemLink.filePath;
	for (var c = 0; c < checkboxes.length; c++) {
		var allGraphics= app.activeDocument.allGraphics;
		
		// seek instances and change visibility
		
		for (var i = 0; i < allGraphics.length; i++) {
			if (allGraphics[i].itemLink == null) {
				continue;
			}
			
			if (allGraphics[i].itemLink.filePath == graphicFile) {
				allGraphics[i].graphicLayerOptions.graphicLayers[c].currentVisibility = checkboxes[c].value;
				pbar_layer.value++;
			}
		}
	}
	
	allGraphics = app.activeDocument.allGraphics;
	
	// set link update option
	for (var i = 0; i < allGraphics.length; i++) {
		if (allGraphics[i].itemLink == null) {continue;}
		if (allGraphics[i].itemLink.filePath ==graphicFile) {
			if (updateOptionSel = updateOptionsPanel.children[0].value == true) {
				allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.APPLICATION_SETTINGS;
			} else {
				allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.KEEP_OVERRIDES;
			}
			
			pbar_layer.value++;
		}
	}
	
	pbarWindow.close();
}

function setCheckboxStatus() {
	if (ui_layerList.selection.checked == true) {
		ui_layerList.selection.checked = false;
	} else {
		ui_layerList.selection.checked = true;
	}

	var tempSel = ui_layerList.selection;
	ui_layerList.selection = null;
}

function pbar () {

	pbarWindow = new Window ("palette", "Processing ...", undefined);
	pbarPanel = pbarWindow.add("panel");
	pbarPanel.add("statictext", undefined, "Progress:");
	pbar_layer = pbarPanel.add("progressbar", undefined, 0, (instancesCount * checkboxes.length) + instancesCount);
	pbar_layer.preferredSize.width = 200;
	pbarWindow.show();

}

 

 

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...
Mar 04, 2020 0
Explorer ,
Mar 04, 2020

Copy link to clipboard

Copied

Brilliant!!! Thank you once again @crazyPanda it works perfect! 

 

Would adding a button for "check all"  & "check none" be a difficult ask?  Alternatively, shift+click to select first and last. 

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...
Mar 04, 2020 0
Participant ,
Mar 05, 2020

Copy link to clipboard

Copied

Well,

just for the heck of it I added a third button that inverts the selection.

blv1-4.png

#targetengine "batchLayerVisibility"

var graphicInstances = null, instancesCount = null, checkboxes = null, ui_layerList = null, sel = null, pbarWindow = null, pbar_layer, pbarText;

main();

function main() {

	proceed = false;

	if (app.selection.length == 0) {
		alert("Nothing selected.");
		exit();
	}

	sel = app.selection[0];
	
	sel = sel instanceof PDF ? sel : sel.graphics[0];
	try {
		var test = sel.graphicLayerOptions.graphicLayers;

		if (test.length == 0) {
			alert("Selected object not supported.");
			exit();
		}

		} catch (err) {
			alert("Please select an .AI image with the white selection tool or click in the links panel on the graphic.");
			
			exit();
		}
		
		var graphicFile = sel.itemLink.filePath;

		graphicInstances = [];

		var allGraphics= app.activeDocument.allGraphics;

    // collect instances

    for (var i = 0; i < allGraphics.length; i++) {

	if (allGraphics[i].itemLink == null) {
		continue;
	}

	if (allGraphics[i].itemLink.filePath == graphicFile) {
		graphicInstances.push(allGraphics[i]);
	}
    }
	
	instancesCount = graphicInstances.length;

	makeDialog();
}

function makeDialog() {
	var w = new Window("dialog", "Batch Layer Visibility 1.4");
	w.alignChildren = ["fill", "fill"];
	checkboxes = [];
	
	var panel = w.add("panel", undefined, "Page x of y");
	panel.alignChildren = ["fill", "fill"];
	
	var panelStack = panel.add("group");
	panelStack.orientation = "stack";
	
	var g_options = graphicInstances[0].graphicLayerOptions;
	var g_layers = graphicInstances[0].graphicLayerOptions.graphicLayers;
	var g_layersCount = g_layers.length;
	
	var layersPerPage = 10;
	var pages2create = (g_layersCount / layersPerPage);
	pages2create = g_layersCount % layersPerPage == 0 ? pages2create : pages2create +1;
	var stackPages = [];
	var curLayer = 0;
	
	for (var p = 0; p < pages2create; p++){
		stackPages.push(panelStack.add("group"));
		stackPages[p].orientation = "column";
		stackPages[p].alignment = ["fill", "top"];
		
		for (var i = 0; i < layersPerPage; i++){
			//curLayer++;
			
			var cb_group = stackPages[p].add("group");
			cb_group.alignment = ["fill", "fill"];
			cb_group.orientation = "row";
			checkboxes.push( cb_group.add("checkbox") );
			
			var cb_label = cb_group.add("statictext", undefined, g_layers[curLayer].name);
			checkboxes[curLayer].value = g_layers[curLayer].currentVisibility;
			
			curLayer++;
			
			if(curLayer > g_layersCount -1){
				break;
			}
		}
		
		if (p == 0){
			stackPages[p].visible = true;
		} else {
			stackPages[p].visible = false;
		}
		
		if(curLayer > g_layersCount -1){
			break;
		}
	}
	
	panel.text = "Page 1 of " + stackPages.length;
	
	var btnsPanel = w.add("group");
	btnsPanel.orientation = "column";
	
	var selectBtns = btnsPanel.add("panel");
	selectBtns.orientation = "row";
	selectBtns.alignment = ["fill", "bottom"];
	selectBtns.alignChildren = ["fill", "fill"];
	selectBtns.orientation = "row";
	
	var selectAllBtn = selectBtns.add("button", undefined, "Select all");
	var invertAllBtn = selectBtns.add("button", undefined, "Invert Selection");
	var deselectAllBtn = selectBtns.add("button", undefined, "Deselect all");
	
	selectAllBtn.onClick = function(){
		for (var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = true;
		}
	}
	
	deselectAllBtn.onClick = function(){
		for(var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = false;
		}
	}
	
	invertAllBtn.onClick = function(){
		for(var i = 0; i < checkboxes.length; i++){
			checkboxes[i].value = checkboxes[i].value == true ? false : true;
		}
	}
	
	var pageBtns = btnsPanel.add("panel");
	pageBtns.alignment = ["fill", "bottom"];
	pageBtns.alignChildren = ["fill", "fill"];
	pageBtns.orientation = "row";
	
	var prevBtn = pageBtns.add("button", undefined, "Previous Page");
	var nextBtn = pageBtns.add("button", undefined, "Next Page");
	
	var curPage = 0;
	
	prevBtn.onClick = function(){
		if(curPage == 0){
			return;
		}
		
		stackPages[curPage].visible = false;
		stackPages[curPage -1].visible = true;
		panel.text = "Page " +  (curPage) + " of " + stackPages.length;
		
		if(curPage > 0){
			curPage--;
		}

	}
	
	nextBtn.onClick = function(){
		if(curPage == stackPages.length -1){
			return;
		}
		
		stackPages[curPage].visible = false;
		stackPages[curPage +1].visible = true;
		panel.text = "Page " +  (curPage +2) + " of " + stackPages.length;
		
		if(curPage < stackPages.length -1){
			curPage++;
		}
	}
	
	update_options = [];   
	
	updateOptionsPanel = w.add("panel", undefined, "Link Update Options");
	updateOptionsPanel.alignChildren = ["fill", "fill"];
	update_options[0] = updateOptionsPanel.add("radiobutton", undefined, "PDF Visibility");
	update_options[1] = updateOptionsPanel.add("radiobutton", undefined, "Custom Visibility");   
	
	if (sel.graphicLayerOptions.updateLinkOption.toString() == "APPLICATION_SETTINGS") {
		update_options[0].value = true;
	} else {
		update_options[1].value = true;
	} 
	
	var btnGrp = w.add("group");
	
	btnGrp.orientation = "row";   
	
	var closeBtn = btnGrp.add("button", undefined, "Exit", {name: "cancel"});
	
	closeBtn.onClick = function () {
		w.close();
		exit();
	}   

	var exeBtn = btnGrp.add("button", undefined, "OK", {name: "ok"});
	
	if(w.show() ==1) {
		app.doScript(setVisibility, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.entireScript, "Batch Layer Visibility");
	}
}

function setVisibility() {
	pbar();
	var graphicFile = sel.itemLink.filePath;
	for (var c = 0; c < checkboxes.length; c++) {
		var allGraphics= app.activeDocument.allGraphics;
		
		// seek instances and change visibility
		
		for (var i = 0; i < allGraphics.length; i++) {
			if (allGraphics[i].itemLink == null) {
				continue;
			}
			
			if (allGraphics[i].itemLink.filePath == graphicFile) {
				allGraphics[i].graphicLayerOptions.graphicLayers[c].currentVisibility = checkboxes[c].value;
				pbar_layer.value++;
				pbarText.text = "Layer " + (c+1) + " of " + checkboxes.length; 
			}
		}
	}
	
	allGraphics = app.activeDocument.allGraphics;
	
	// set link update option
	for (var i = 0; i < allGraphics.length; i++) {
		if (allGraphics[i].itemLink == null) {continue;}
		if (allGraphics[i].itemLink.filePath ==graphicFile) {
			if (updateOptionSel = updateOptionsPanel.children[0].value == true) {
				allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.APPLICATION_SETTINGS;
			} else {
				allGraphics[i].graphicLayerOptions.updateLinkOption = UpdateLinkOptions.KEEP_OVERRIDES;
			}
			
			pbar_layer.value++;
		}
	}
	
	pbarWindow.close();
}

function setCheckboxStatus() {
	if (ui_layerList.selection.checked == true) {
		ui_layerList.selection.checked = false;
	} else {
		ui_layerList.selection.checked = true;
	}

	var tempSel = ui_layerList.selection;
	ui_layerList.selection = null;
}

function pbar () {

	pbarWindow = new Window ("palette", "Processing ...", undefined);
	var pbarPanel = pbarWindow.add("panel", undefined, undefined);
	pbarText = pbarPanel.add("statictext", undefined, "Progress:");
	pbarText.alignment = ["fill","fill"];
	pbar_layer = pbarPanel.add("progressbar", undefined, 0, (instancesCount * checkboxes.length) + instancesCount);
	pbar_layer.preferredSize.width = 200;
	pbarWindow.show();

}

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...
Mar 05, 2020 1
Explorer ,
Mar 05, 2020

Copy link to clipboard

Copied

@crazyPanda,  I can't thank you enough. This script has been a serious time saver for me. Thank you for your continued support while perfecting this incredibly useful tool. 

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...
Mar 05, 2020 0
Community Beginner ,
Jul 08, 2020

Copy link to clipboard

Copied

@crazyPanda This script is excellent. The fact that this doesn't exist built in is a shame but luckily there's people like you around. Does anyone know if it's possible to modify this to include INDD files? Also would there be a way to select multiple files at once and change the layers without having to blanket change every instance in the document?

 

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...
Jul 08, 2020 1
Community Beginner ,
Aug 21, 2020

Copy link to clipboard

Copied

@crazyPanda What about layered InDesign file placed in an InDesign file. Anybody tried for that..

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...
Aug 21, 2020 0
New Here ,
Jul 02, 2020

Copy link to clipboard

Copied

Why doesn't AI just have tthis built in? I just wasted 2 hours trying to figure out where these features were, only to find that this intuitive, expected feature requires a script. Do proactive, complete work, Adobe. How many users' time are you wasting? 

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...
Jul 02, 2020 0