Yes it can be done using a script to run an action on all layers in Photoshop.
Create your action to do what you want.
Edit the script with your Actionname and Actionset
Using a text editor or better still ExtendScript Toolkit save this out as FileName.jsx into the correct folder:-
PC: C:\Program Files\Adobe\Adobe Photoshop CS#\Presets\Scripts
PC 64bit 32bit Photoshop: C:\Program Files (x86)\Adobe\Adobe Photoshop CS#\Presets\Scripts
MAC: <hard drive>/Applications/Adobe Photoshop CS#/ Presets/Scripts
# being the CS version.
N.B. If Photoshop was open close and restart!
To Use : - File > Scripts > select script
[PHP]var doc = activeDocument;
for(var a =0;a<doc.layers.length;a++){
doc.activeLayer = doc.layers[a];
//Amend the action name and action set to suit
app.doAction("ActionName", "ActionSet"); //These are case sensitive!!!!
if(doc.activeLayer.name != "Layer 1") doc.activeLayer.visible=false;
}[/PHP]