Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe Photoshop Scripting Newbie Seeks Help

  • Scripting Newbie Seeks Help

    Posted by Michael Rothenberg on October 8, 2008 at 6:09 pm

    I’m not looking to become a scripting master but I do have a specific task I’d like to achieve – I wonder if anyone can give me some script nuggets so that I don’t have to figure it out from scratch?

    I have multilayered PSD files that I’d like to export as JPEGS in a progressive manner. In other words, filename.0 would be Layer 0 only; then filename.1 would be Layer 0 + Layer 1; and so on up to the top of the file.

    Thanks in advance for any advice or assistance!

    Michael Rothenberg
    Peak Productions

    Michael Rothenberg replied 17 years, 7 months ago 2 Members · 4 Replies
  • 4 Replies
  • Ekim Wahs

    October 8, 2008 at 8:58 pm

    In file/scripts there is already a script for saving layers to files. See if that works for you.

    Mike Shaw
    Photoshop QE

  • Michael Rothenberg

    October 8, 2008 at 9:54 pm

    Thanks. Of course that was the first thing I looked at, but I am looking to do something different and I don’t know how to modify the script.

    I want the file exports to ADD each layer to the prior export – in other words, the last export would be a JPEG of the whole file.

    Any thoughts?

    Michael Rothenberg
    Peak Productions

  • Ekim Wahs

    October 9, 2008 at 7:49 pm

    Use this to create a new script. It will dupe the doc, then create layer comps setting the visibility for layers from the bottom up. You can then use Layer Comps to files script to save files of the layer comps.

    var docRef = app.activeDocument;
    var layerCount = docRef.layers.length

    var duppedDocument = app.activeDocument.duplicate();
    duppedDocument.activeLayer = duppedDocument.layers[duppedDocument.layers.length-1]; // for removing
    setInvisibleAllArtLayers(duppedDocument);
    setVisibleLayersComps(duppedDocument);

    function setInvisibleAllArtLayers(obj) {
    for( var i = 0; i < obj.artLayers.length; i++) { //obj.artLayers[i].allLocked = false; obj.artLayers[i].visible = false; } } function setVisibleLayersComps(obj) { var layerCount = obj.artLayers.length -1 for( var i = 0; i < obj.artLayers.length; i++) { //obj.artLayers[i].allLocked = false; obj.artLayers[layerCount].visible = true; compName = obj.artLayers[layerCount].name obj.layerComps.add(compName, '', true, true, true); layerCount = layerCount-1 //compName = artLayers[i].name } } Mike Shaw Photoshop QE

  • Michael Rothenberg

    October 10, 2008 at 2:24 pm

    Mike,

    Thank you SO much. It never fails to amaze me how much ingenuity and generosity some people show. Of course making the Layer Comps was the way to go! This worked perfectly and I am deeply grateful. This is going to make our workflow SO much easier. Mike, if you’d accept remuneration I’d really like to compensate you in some way. Please contact me directly to discuss.

    But in the meantime please accept my sincerest thanks.

    All the best,
    Mike R.

    Michael Rothenberg
    Peak Productions

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy