Export the visible layers in photoshop by using the script.

Hello

I am new to adobe script, so please forgive me if this has been covered before.

I have a book script Adobe Scripting of Chandler McWilliam, I want to use. Essentially, it exports all visible layers in a document open in PS. The script works, but I can't seem to export to a folder/directory of my choice. It is default export to the folder that contains the Photoshop application.

I use a Mac.

The Script looks like this:

function exportVisible (doc) {}

var myJPEG = new JPEGSaveOptions();

myJPEG.quality = 10;

myJPEG.formatOptions = FormatOptions.STANDARDBASELINE;

var myPath = ' / users/tr/Desktop/JAVATESTFOLDER ";

var myFolder = new Folder (myPath);

myFolder.create ();

var settings = new Array();

var current; Reference to the current layer

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

current = doc.layers [i];

settings [i] = current.visible;

doc. Layers [i]. Visible = false;

}

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

current = doc.layers [i];

If (settings [i]) {}

Current.Visible = true;

var myFile = new File ("Img-" + current.name + '.jpg');

doc.saveAs (myFile, myJPEG, true);

Current.Visible = false;

}

}

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

current = doc.layers [i];

Current.visible = settings [i];

}

}

exportVisible (activeDocument);

I tried many variations, but in vain. I would be very grateful for any advice.

I've not heard JJ found, but you need to add the path of access, but with my corrections.

var myFile = new file (myPath + "/ Img-" + current.name + '.jpg');

Tags: Photoshop

Similar Questions

  • Cannot export the script to AV as a .txt file

    I'm working on the script AV. I have exported successfully to PDF without any problem.

    If it has the option, when I click on file/export under... / text document, nothing happens, just no response. I exported several other AV scripts in the form of text documents that were of similar lengths and with similar content. Why is not now it works?

    It's currently a bug and we will address it in our next release.

    To work around the problem, you can try the following steps-

    -export the document under ASTX AV

    -Import the file ".astx" in history. (He'll get imported as a movie script)

    -Export this movie in text format script.

  • Select visible layers

    Is it a Photoshop hack that lets me SELECT the VISIBLE LAYERS, ignore the (dozens and dozens of) hidden layers and CREATE A NEW GROUP FROM THE LAYERS VISIBLE?

    Hi vernehenzel,

    Please visit the following link: Possible to select all visible layers in Photoshop?-Graphic Design Exchange of battery

    Please let me know if it helps.

    Kind regards

    Tanuj

  • Export the application

    I exported the app and now it imported to a different workspace, but all tables that is the app uses not were not exported, so how to export sql objects (tables) in one workspace to another.

    Senks.

    Developer SQL has an available database (schema level) export feature ( Menu - > tools-> database export ). You can use it to export the script to create object with insert statement for the data.

    Apex generator also has a function to export schema ( -> SQL Workshop-> Utilities generate DDL ) with which you cane export the schema definition.

    These two files can be run in the destination schema to recreate the objects.

    PS: Please update your grip for a more friendly forum

  • I just bought a year of CC version... When I login my account, the payment is visible, I downloaded photoshop and I wasn't able to get the work permit im always using an aplication free period. It is said that no payment or upated is the registry under t

    I just bought a year of CC version... When I login my account, the payment is visible, I downloaded photoshop and I wasn't able to get the work permit im still using a free period aplications. It is said that no payment or upated is the registry under this ID

    Hello

    Please check the help below document:

    Applications creative Cloud back in test mode after an update until 2015 for CC

    Kind regards

    Sheena

  • The invisible layers using the text returned on visible layers

    I'm working on a newsletter page 8 for a customer. There are 5 versions of the newsletter of new pages 3-6 are common to all the 5 editions, pages 1-2 and 7-8 is unique to each version. I use an InDesign document with 6 layers, 1 layer of background (#1) pour common/story layouts and a separate layer for each version (#2-#6). When laying on the stories of page 7 (a single page) my invisible layers affect the provision on visible layers. I have a story on layer #2 all plotted, so when I move to the layer #3 I disable #2 and light #3 which should give me a blank page to work with. The page appears empty, but when I add my pictures and text, information on layer #3 is being moved by what looks like a build-up of layer #2. Why is this invisible layer affecting the layout on a visible layer? How do I fix this so I don't have to go back and rebuild individually 5 versions? Thank you!

    It is exactly as expected. If you want to disable, open the properties of the layer of hidden layers, and it can be.

  • I have problem in the PDF export to save only the layers appeared only. When I export the indesign file to PDF that contains layers hidden pdf placed, pop up problem when I use the search field in exported pdf file. hidden text of hits from search results

    I have problem in the PDF export to save only the layers appeared only. When I export the indesign file to PDF that contains layers hidden pdf placed, pop up problem when I use the search field in exported pdf file. hidden text of hits from search results to laye

    I answered your question: there is nothing you can do in InDesign. You need to ask in the Acrobat forum I linked.

  • How to use the same mask, stencil, etc for several layers? Photoshop equivalent of the masked group?

    Hi I spent over half an hour for search manual, forums and the Internet and still can't find the answer. Help, please!

    For example, in a model with 5 or more layers, I want to use the same mask or stencil or what can hide layers 2,3 and 4 but areas layer 5 and all other possible layers below should not be affected.

    1. Before dialing the layers that you want to hide and apply a matte for the demo using the mask. Think to the Dial as an equivalent to the creation of a layer group.
    2. Use the effect on each layer you want to hide. It's easier to do if you apply mast set once and then create an animation preset to apply to the other layers. Just get mast set to do what you want it to do on the first layer, select Set Matte in ECW or in the timeline panel, and then go to the Animation > Save animation preset. Select then all other layers you want to apply the set matte to apply the preset.
    3. Put the mask at the bottom of the layers that you want to hide and turn on the switch to preserve transparency, then this group in composition with other layers of nesting.

    Here's another tip. You can set a custom color for all the layers you want to use the mast, then use the custom color for a group selection. This can make things easier down the line.

  • Is it possible to export the layers of work plans?

    I was so happy when Adobe introduced plans to work in Photoshop. And was impatient to try it on the practice. And earlier I finished Web site design that has by page 3 work plans. And a lot of layer comps on every page.

    And it turned into a nightmare...

    I can't export all the layers automatically. I have to manually put in each layer comp, click on "export as...". ». In the same file names are the same (called as a work plan). So I have to rename the exported images before the switch then layer comp and export it.

    If I use the command "export > Layer Comps to files...". ', it exports all work plans in 1 file for each layer comp. But the worst thing is that these files look like this:layouts.jpg

    -with huge space empty around work plans.

    I spent a lot of time designing the site and now I even can't show the client!

    So my question is:

    Is there a way to export the layers of each work separately plan with corresponding file names? (as it works for the old "Layer Comps to files... ("without work plans).

    But if there is no solution I think it's a major issue in usability.

    Thank you in advance for your help!

    If nothing else arises perhaps you should ask for help on to

    Photoshop scripts

  • Is it possible to only select the visible layers to copy/paste in place.

    Hello!

    I must be missing something.  In Adobe Illustrator, when you select a layer (or Sub-layer) to copy, is it possible to copy only visible layers and not those hidden?

    When I provide my clients with their final illustrator files, I only want to register the approved artwork.  Currently, I make a copy of the file and go through and delete hidden files, it would be much easier to copy and paste in place visible layers in an Adobe illustrator file.

    Thank you!

    Given that your items are grouped, select objects on the artboard should be as effective as Select layers in the layer panel.

    You will not be able to resolve this layer-selection-irritation. Happened for some versions. You might consider to report it as a bug.

    The link that I used to post on these occasions no longer works. Google sent me this one, I hope it works for you:

    Home

  • Photoshop CS6 using javaScript to truncate the name of the alpha channel

    Hello

    I am a production artist and I work with PSD files created in Adobe Scene7's Image Authoring Tool. These PSD files contain a background as well as the alpha 1-20 layers layer. My script should make a new empty layer for each alpha channel in the document. He then fills the new grey layer. So far, my code accomplishes this mission. However, I would like to apply the alpha channel of the layer name, but I need the name will be truncated. Each alpha channel begins with one or more characters, followed by a bar backslash and then ends with one or more characters. Here is an example:

    An alpha channel can be named: Floor\floor

    In this example, I need my name of layer to be fair: floor. This means that all characters to the left of the backslash, including the backslash itself needs to be scrapped. I used the subSring() for this statement. When I try to step through the code line by line in ExtendScript, I immediately get an error that says no complete string constant and line 31 of my code is highlighted. I think that he doesn't like the way I wrote the backslash character, although I have it surrounded by double quotes to define it as a string.

    Can someone tell me why I get this error?

    Here is my code with a lot of comments to guide you through the process. I wrote where the error occurs in red characters.

    I'm new to JavaScript, so I'm not sure that my while loop is accurate.

    #target photoshop

    #target photoshop makes the script execution in PS.

    declare the variable to contain the active document

    var myDoc = app.activeDocument;

    declare the variable to hold the number of alpha channels, excluding the RGB layers

    var alphaChan = myDoc.channels.length - 3;

    Alert ("alpha channels exist" + alphaChan);

    create a loop to make new layers depends on the number of channels alpha, fill layer with gray and apply the name of alpha channel to the new layer

    for (a = 0; a < alphaChan; a += 1) {}

    make new Virgin layer

    myDoc.artLayers.add ();

    fill empty layer with gray

    var color = new SolidColor();

    Color.RGB.Red = 161;

    Color.RGB.Green = 161;

    Color.RGB.Blue = 161;

    myDoc.selection.fill (color);

    variable stores the name of the alpha channel

    var alphaName = myDoc.channels [3 + a];

    variable stores the length of the name of alpha channel

    var lz = alphaName.length;

    declare the index variable to initialize the character position 1 the name of alpha channel

    var x = 0;

    truncate the name of the alpha channel by removing all characters preceding the symbol "\".

    While (alphaName.subString (x)! = ' \ ') { (ExtendScript gives an error for this line and highlights the backslash and surrounding quotes) }

    alphaName = alphaName.subString ((x+1), z);

    x += 1;

    z = 1;

    Return alphaName;

    }

    remove the backslash in name of alpha channel

    alphaName = alphaName.subString ((x+1), z);

    apply name truncated to the corresponding layer alpha channel

    myDoc.artLayers [a] .name = alphaName;

    }

    While (alphaName.subString (x)! = ' \ ') {}

    should be

    While (alphaName.subString (x)! = ' \ ') {}

  • Export the layers separately

    I have Photoshop CC and I loaded a PSD with layers inside.

    Someone created the PSD design to me.

    I'm trying to export all the layers separately but when I go to the Scripts > > export layers to files, he mixes a little a particular layer with all of the other layers.

    If I can ever get a layer on its own.

    Take a look at one of these exports below. The upper shadow should be on its own, but its accompanied by lower layer also. All other files are also accompanied by the lower layer. No idea how I can export just all layers of their own?

    _0001s_0001s_0003_button-colr_2.png

    I moved the top layer down and he run. This time, it worked!

  • images from the list for a visible layers only

    Hello

    I need images for the visible layers is ' true 'only. "

    i.e. document includes 10 images, but the conditions (layers visible = true) then images of document is 7.

    Trying Code:
    
    var myDoc = app.activeDocument
    
    var myGraphics = app.activeDocument.allGraphics
    
    alert("docMyGraphics " + myGraphics.length)
    
    var myLayer = app.activeDocument.layers.everyItem().getElements()
    
    for(k=0; k<myLayer.length; k++)
    {
        if(myLayer[k].visible == true)
        {
            for(i=0; i<myGraphics.length; i++)
            {
                alert(myGraphics[i].itemLink.name)
                }
            }
        }
    

    Could someone rewrite my code and give a solution.

    Please, it's very urgent...

    Thank you

    Beginner

    Hey beginner, Hey Suresh.

    http://jongware.mit.edu/idcs5/pc_Layer.html

    Each layer has its own ' allGraphics property, for a nicer way to do is to use that:

    var doc = app.activeDocument;
    var myLinks = [];
    for (var i = 0; i < doc.layers.length; i++) {
              if (doc.layers[i].visible) {
                        myLinks.push("Layer "+i+"("+doc.layers[i].name+"):")
                        var layerGraph = doc.layers[i].allGraphics;
                        for (var j = 0; j < layerGraph.length; j++) {
                                  try {                                        //  not all graphics have a itemLink, for example the embedded ones
                                            myLinks.push(layerGraph[j].itemLink.name);
                                  } catch (e) {
                                            myLinks.push("Error: Graphic " + j + " on layer " + i + " might be embedded");
                                  }
    
                        }
              }
    }
    alert (myLinks.join("\r"));
    
  • my keyboard has sometimes unresponsive, despite verified the above. Then it works again after I have shut down and restart my mac. is this normal? If this isn't the case, that due to an application? for example, I installed photoshop and use it all the ti

    Jin

    Sometimes, my keyboard stops responding, despite the checkist troubleshooting.

    Then it works again after I have shut down and restart my mac!

    is this normal? If this isn't the case, that due to an application? for example, I installed photoshop and use it all the time... also openoffice document prog...

    What else could be?

    I just replace the keyboard with a new one, but the problem persists.

    my mac has also been in mac repair and they found nothing wrong.

    Thank you!

    Please run and view a report of EtreCheck http://etrecheck.com/

  • My problem is that when I try to save an image from Adobe Photoshop by using the 'save for Web' half of the dialog box does not appear.

    I use a Vista Home Premiuim Windows in an Acer Aspire One 10.1 "." My problem is that when I try to save an image from Adobe Photoshop by using the 'save for Web' half of the dialog box does not appear. Can someone help me please?

    Here is a screenshot of my problem...
    [IMG] http://i55.tinypic.com/of5w01.png [line]
    Help me please.

    Hello

    1. were you able to see the front dialog box?

    2. did you of recent changes to the computer?

    This happens because your screen resolution is less than the required minimum of 1024 x 768.

    You can try to change the resolution of the monitor and check.

    For more information, see the link:

    Change settings display on multiple monitors

    Change the screen resolution

    You can also refer to Adobe support links and also post your request in the Forum from Adobe for assistance:

    http://forums.Adobe.com/thread/433020?TSTART=0

    http://kb2.Adobe.com/CPS/403/kb403268.html

    http://forums.Adobe.com/community/Photoshop/photoshop_windows

    Hope this information is useful.

Maybe you are looking for

  • iPhone battery woes 5 after replacement

    Hello my iphone 5 qualified for the free battery replacement program and was replaced in November 2014. After exactly one year, replaced battery started acting like the old. She just quickly throws herself from the moment wherever it comes down to 40

  • Save the report that VI of report generation toolkit is broken

    Hi all I created a journal vi data, using report generation tools. He works first and then I copied the vi to another folder and tried to run but ended up with a broken vi.  The error occurs in the Save report vi of report generation package.   Pleas

  • Is the S7 SDXC UHS - I supported Flash cards?

    I think of buying this but want to use a SD card for additional storage. The S7 would support SDXC UHS - I Flash cards?  What is with SDXC in general?

  • Display too large for the screen prevents access to apply or OK buttons to implement changes to the resolution.

    Can not access to apply or the buttons OK for changes in the resolution, because the text size too wide and does not scroll in.   Having the same problem trying to scanning/printing document.   How to restore the default resolution without being able

  • Missing hard drive space

    Good afternoon... It seems that whenever I surf the web, watch a video on Youtube, etc., my temporary internet file is stored on my hard drive. I decided this because I run a security scan every time I find myself with the files of nearly 2 million s