The script doesn't track by layer name, so if you add or remove a layer between uses, your layer visibility will be shifted. Fortunately, I'm using a simple system of 1's and 0's to track visibility, so you can easily edit the saved values if you added or removed a layer between runs.
Another limitation/caveat: This version doesn't look at sub-layers, just top level layers.
Someone who know how to write plugins should probably write something like this, but until then, if you're dying for a layer "save state" script, this should get you started.
Just run the script posted below and a prompt will come up with a bunch of ones and zeros in the text entry field. These represent the visibility of each root layer in your document. If you want to save your layer state, just manually copy the prompt data to a text document for use later.
When you want to reset your visibility to an older saved state, just rerun the script, and paste your saved string back into the prompt window, (erasing the existing data) and your layers will return to the original visibility settings.
Enjoy, and if you have any suggestions, requests or improvements, please email me, or post in the comments below.
cheers,
-J
var doc = activeDocument; var binArr=[]; var i = 0; for(var d=doc.layers.length-1;d>=0;d--) { i= doc.layers[d].visible ? 1:0; binArr.unshift(i); } var p=prompt("Copy values to store layer visibility states, paste new data below to change.",binArr.join("")); if (p!=null) { binArr = p.split(""); for(var d=binArr.length-1;d>=0;d--) { if(doc.layers.length > d){ doc.layers[d].visible = binArr[d] == 0 ? false : true; } } }