Gr Kosta,
Do you mean that you want to be able to undo both layer setting changes in a single undo? If so, this can be done using app.doScript using UndoModes.entireScript:
myDokument = app.activeDocument; app.doScript(ChangeLayerFunc, ScriptLanguage.javascript, undefined, UndoModes.entireScript, "Your Undo Text"); function ChangeLayerFunc() { myDokument.layers.item("Layer 1").visible = true; myDokument.layers.item("Layer 2").visible = true; }
I hope this helps!
-- Jim