Script that saves every visible layer as individual file in folder with same name

Hello.
In my PSD I have many folders with unique name (like "1234"), that contains layers named as digits (like "0", "1", "2" etc).
I need to save each layer as JPG to folder with the same name and hierarchy that is in PSD file.
How to do that using JavaScript .jsx scripts?
Thank you for any response.

What exactly is the problem – addressing the Layers, creating the Folder structure, …?

Similar Messages

  • Advanced "Save as PDF" script that saves 2 PDF presets with 2 different Names

    HI Everyone,
    I am looking to improve a save as pdf workflow and was hoping to get some direction. Here is the background...
    I routinely have to save numerous files as 2 separate PDFs with different settings (a high res printable version and a low res email version). Each file has to be renamed as follows...
    Original filename = MikesPDF.ai
    High Res PDF Filename = MikesPDF_HR.pdf
    Low Res PDF Filename = MikesPDF_LR.pdf
    I was able to alter the default "SaveAsPDF" script to save the files to my desired settings and to add the suffix to the name. So with these scripts here is how the workflow operates...
    1. Open all files I wish to save as pdfs
    2. Select script to save files as high res pdfs
    3. Illustrator asks me to choose a destination.
    4. Illustrator adds the appropriate suffix and saves each file as a pdf to my desired setting. ("Save As" not "Save a Copy").
    5. Now all of the open windows are the new pdfs, not the original ai files.
    6. Now I have to close each window. For some reason Illustrator asks me if I want to save each document when I tell it to close window, even though the file was just saved. I tell it to not save and everything seems to be fine.
    7. Reopen all the files I just saved as high res pdfs.
    8. Repeat the entire process except I run the script specifically designed for the low res pdfs.
    What I would like to do is to combine these two processes so that there will be one script that saves both pdfs. From what I understand, the script can't support "Save A Copy" so the workflow would go as follows...
    1. Open all files I wish to save as pdfs
    2. Select single script to save files as both high res and low res pdfs
    3. Illustrator asks me to choose a destination.
    4. Illustrator saves each file as a High Res PDF and adds the the "_HR" suffix.
    5. Illustrator then re-saves the open windows as a Low Res PDF and replaces the "_HR" suffix with "_LR".
    Here is the code for the High Res script, The Low Res script is pretty much the same except for a different preset name and different suffix. Any pointer that anyone could give me would be most appreciated. I am pretty much a noob to this stuff so please keep that in mind.
    Thanks!
    Mike
    ---------------------------CODE----------------------------
    /** Saves every document open in Illustrator
      as a PDF file in a user specified folder.
    // Main Code [Execution of script begins here]
    try {
      // uncomment to suppress Illustrator warning dialogs
      // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
      if (app.documents.length > 0 ) {
      // Get the folder to save the files into
      var destFolder = null;
      destFolder = Folder.selectDialog( 'Select folder for PDF files.', '~' );
      if (destFolder != null) {
      var options, i, sourceDoc, targetFile;
      // Get the PDF options to be used
      options = this.getOptions();
      // You can tune these by changing the code in the getOptions() function.
      for ( i = 0; i < app.documents.length; i++ ) {
      sourceDoc = app.documents[i]; // returns the document object
      // Get the file to save the document as pdf into
      targetFile = this.getTargetFile(sourceDoc.name, '.pdf', destFolder);
      // Save as pdf
      sourceDoc.saveAs( targetFile, options );
      alert( 'Documents saved as PDF' );
      else{
      throw new Error('There are no document open!');
    catch(e) {
      alert( e.message, "Script Alert", true);
    /** Returns the options to be used for the generated files. --------------------CHANGE PDF PRESET BELOW, var NamePreset = ----------------
      @return PDFSaveOptions object
    function getOptions()
    {var NamePreset = 'Proof High Res PDF';
      // Create the required options object
      var options = new PDFSaveOptions();
         options.pDFPreset="High Res PDF";
      // See PDFSaveOptions in the JavaScript Reference for available options
      // Set the options you want below:
      // For example, uncomment to set the compatibility of the generated pdf to Acrobat 7 (PDF 1.6)
      // options.compatibility = PDFCompatibility.ACROBAT7;
      // For example, uncomment to view the pdfs in Acrobat after conversion
      // options.viewAfterSaving = true;
      return options;
    /** Returns the file to save or export the document into.----------------CHANGE FILE SUFFIX ON LINE BELOW, var newName = ------------------
      @param docName the name of the document
      @param ext the extension the file extension to be applied
      @param destFolder the output folder
      @return File object
    function getTargetFile(docName, ext, destFolder) {
      var newName = "_HR";
      // if name has no dot (and hence no extension),
      // just append the extension
      if (docName.indexOf('.') < 0) {
      newName = docName + ext;
      } else {
      var dot = docName.lastIndexOf('.');
      newName = docName.substring(0, dot)+newName;
      newName += ext;
      // Create the file object to save to
      var myFile = new File( destFolder + '/' + newName );
      // Preflight access rights
      if (myFile.open("w")) {
      myFile.close();
      else {
      throw new Error('Access is denied');
      return myFile;

    Thank you for the reply Bob!
    Am I correct in assuming that these few lines of code replace all of the lines that I posted above?
    Also, When populating the PDFSaveOptions lines, would the end result look like this? FYI, LowRes preset name = "Proof Low Res PDF - CMYK". HighRes preset name = "Proof High Res PDF"
    #target illustrator
    #targetengine "main"
    for (x=0;x<app.documents.length;x++)
         var workingDoc = app.documents[x];
         var workingDocFile = workingDoc.fullName;
    // populate these with your settings
         var lowResOpts = new PDFSaveOptions(Proof Low Res PDF - CMYK);
         var highResOpts = new PDFSaveOptions(Proof High Res PDF);
         var lowResFile = new File(workingDocFile.toString().replace(".ai","_LR.pdf"));
         workingDoc.saveAs(lowResFile,lowResOpts);
         var highResFile = new File(workingDocFile.toString().replace(".ai","_HR.pdf"));
         workingDoc.saveAs(highResFile,highResOpts);
         workingDoc.close(SaveOptions.DONOTSAVECHANGES);

  • Create a script to save multiple groups into seperate png files

    Hello,
    I want to use a script to save every group I made into a '.PNG. I'm visualizing something like this, but the outputformat/name doesn't matter, as long it is a output from a group:
    group1 -> 1.png
    group2 -> 2.png
    group3 -> 3.png
    group4 -> 4.png
    etc.
    I noticed that someone create a script like that, but it isn't using for me anymore. Find here the script that isnt working for me:
    Re: Export Groups to Files?
    I am using Photoshop CC 2014 on Windows 7 (64bit).
    Looking forward to your reply! Thanks.
    Kind regards,
    Joost

    Which code cpu you use and what does
    but it isn't using for me anymore.
    mean exactly?

  • HT1553 i am upgrading my 2008 macbook to an ssd drive and want to save my settings. how do i save then? I have my files backed up with time machine ,but dont want to restore all files ,as there might be some junk backed up too. Help will be appretiated

    i am upgrading my 2008 macbook to an ssd drive and want to save my settings. how do i save then? I have my files backed up with time machine ,but dont want to restore all files ,as there might be some junk backed up too. Help will be appretiated

    When you restore from a Time Machine back up you can pick and chose what is restored. It is not an all or nothing process. Nor do you have to do the partial restores all at the same time. If days after the first partial restore you find something else you want you can restore just that.

  • Script to find files with same names with in a folder and it sub folders.

    Looking for script to find files with same names with in a folder and it sub folders.

    Are you just looking to find if any two files underneath a folder have the same name?
    If you just want to know that a file named "whatever" exists in two folders, that's not too difficult, but you probably want to know the full path names.
    Here's one attempt:
    $ perl -MFile::Find -le 'find(\&w, "."); while (($n,$p)=each %file) {if(@{$p}>1){print join(" ",@{$p})}} sub w{push @{$file{$_}},$File::Find::name;}'That will print the pathnames on the same line of any files with the same name that appear anywhere underneath your current directory.
    It's a bit long for a "one-liner", but functional.
    Darren

  • My new mac mini (3 month) didn't start up,all that appeared was a white screen and a flashing folder with a question mark inside it.

    My new Mac mini (3 month) didn't start up, all that appeared was a white screen and a flashing folder with a question mark inside it.
    I followed by recommendations from 'Everything Mac': "shut it down by pressing and holding the power button for about 5 seconds.
    Then hold down the Option key and press the power button again to start up the Mac mini. Keep holding down the Option key until
    the Mac mini starts up."
    But I got a Wi-Fi button only to chose and connect the local network. I connected to my network and I can't use this connection
    becouse no icons.
    Could you please help me?

    Your Mini (running 10.6.4) should have come with grey-colored install disks. Now is the time to put them into service. Turn on your computer so that there is power to accept disk #1 into the optical drive. Once  the disk is in the drive, shut off the computer by holding the start button down until it powers off. Then turn it on this time holding down the "C" key to make the computer boot from the disk. The question mark that you saw indicates that the computer cannot find a bootable volume. This can happen due to corrupted system files or an improper shutdown etc. Once you are in the "Installer" you can choose Disk Utility from the Utilities Menu in the menu bar. Use it to repair the disk and to see if that can solve your trouble.  

  • A phantom folder with the name of a folder that held photos has appeared in my finders places list.  I can't choose it to delete it.  it won't move.  It can't be found in a search.  How can I choose it and delete it?

    a phantom folder with the name of a folder that held photos has appeared in my finders>places list.  I can't choose it to delete it.  it won't move.  It can't be found in a search.  How can I choose it and delete it?

    Can you drag it off holding down the CMD key?
    Do a search for it with EasyFind  (try different settings in "Operator")
    http://www.devontechnologies.com/products/freeware/

  • I installed the window 7 os in to my mac book pro. after that the partition is not supported and then the folder with question mark flashing on my screen. plaese helf me what to do next to resume the mac os x?

    i installed the window 7 ultimate OS in to my mac book pro. after that the partition is not supported and then the folder with question mark flashing on my screen. plaese helf me what to do next to resume mac mac os x?

    Assuming that you tried to install Win 7 in bootcamp.
    Power on the machine and press and hold the "option" key when you hear the bong sound.
    Select the Macintosh HD icon and press "return" or just click on the icon.
    Once booted into OS X go to System Preferences and select the Startup Disk icon and configure startup to use the Macintosh HD.

  • EPG means that for every change in the .css files I need to load to DB??

    Hi all,
    I have just figured out the answer to a previous post regarding .css files.
    Now checking if anyone can please tell me I am wrong about this:
    Running Apex on ORACLE XE means that every change to a .css file will only be visible after loading the images directory into the database??
    Thanks!

    Yes, that is correct.
    Fortunately, you can map the APEX images directory to the drive in Windows (or volume on a Mac) using WebDAV. This way, you can edit the .css files right on the database, eliminating the need to load them to the database after each change.
    See this post for more details on how to map the database as a drive: http://daust.blogspot.com/2006/03/where-are-images-of-application.html
    Thanks,
    - Scott -
    http://sumnertechnologies.com/
    http://spendolini.blogspot.com/

  • Add text layer to all files in folder: what about files that already are searchable?

    Hi everyone
    I'd like to make my scanned PDF documents searchable using the OCR feature of Adobe Acrobat X Standard. The scanned PDF files are stored in one folder (or its subfolders respectively). In principle I could just go to the OCR feature, tell it to add that folder to the OCR conversion list and replace all PDF files in it with searchable versions.
    Some of the files in the folder, however, already are searchable because they were created from Word files for instance. My question is: What will Acrobat's OCR feature do with these files that already are searchable? Will it leave them unchangend? Or will it create new files and replace their existing "text layer" with a new text layer?
    One of the reasons for my question is, that the existing "text layer" is free of recognition errors by definition (because it has been added by Word's conversion feature). This means, a new text layer added by Acrobat's OCR feature can only be equal or inferior in quality compared to the existing one. In the latter case, it wouldn't make sense to replace the existing "text layer".
    A second reason is that some of the already searchable files have security properties (i. e. signatures). What is going to happen to them when the OCR feature creates a new file?
    Thank you for your answers!

    The usual thing is that Acrobat will object, saying the file contains "renderable text", and do nothing.
    OCR on a file with signatures will, at best, invalidate the signature. More likely, all trace of the signature will be deleted, and it will attempt to do OCR on the visual appearance, finally leaving a graphic. OCR is  not really intended as a late-stage process.

  • Differentiating layers with same name using script

    Hi,
    In Illustrator, different layers can have the same name. Is there any unique identifier to differentiate between the layers having same name? Photoshop assigns an id to each layer. But in Illustrator I could not find any such property. I need to be able to extract some unique identifier for layers in Illustrator using scripting. Any help would be appreciated.
    Thanks.

    Hi Steve,
    I am aware that users can assign any name to layers and that's exactly where I am facing the issue, Layer names can be duplicate and I am at a unable to find a unique identifier for layers. I am looking for a layer property that can serve as the unique identifier. It is really urgent and am stuck with this issue,. Hope I am able to communicate the problem

  • Utility that makes jpg files with same name as avi file

    I would like to have my avi files catalogued in Photoshop elements 2.0 as I do with my photos - tagging etc.
    but I do not want to include the avi files in my photoshop catalogue since when backing all photos all clips would be included = to many GB ( I already back up the avis separately)
    So what I want is an easy way to automatically convert a frame from an avi file and save it with the same name as the avi.jpg - so I can import that to Phel and tag it.
    Any one who knows of such an utility?

    >So what I want is an easy way to automatically convert a frame from an avi file and save it with the same name as the avi.jpg - so I can import that to Phel and tag it.
    Jan,
    Are you aware that the Photoshop Elements Editor has a function that will create a still photo from a frame of a video? Look at File > Import > Frame from Video in the Editor workspace.
    And I think that Premiere Elements 2 may also have a function for capturing a single frame and saving as a photo file. (I don't have Prem Elem 2 available at the moment to verify that it is present in v2.) I believe that it was in Prem Elem 3 that I used this function.
    However, I don't think that either the Photoshop Elements or the Premiere Elements functions satisfy your request that it be automatic. I think that you would need to invoke that command for each video clip and then choose which frame of the video.

  • Create .exe that sends results to .txt, keeps looking for folder with .exe name

    Created a project that logs the results to a .txt file that was setup in "Source File Settings" as a subfolder "Test Results",  but when I run the .exe it trys to write the results to a folder with the same name as my .exe file. I must have something set up wrong under my Build properties.
    Thanks Chuck

    Even though this knowledgebase's question does not address your question directly, it does expand on what Dennis said about the path being different between the development system and the executable. And how the it adds another layer in the executable.
    The part that is most useful to you is this:
    " Consider a VI named Application.vi located in the hard drive's root directory (e.g. C:\). In the LabVIEW development environment, the Current VI's Path function returns:
    C:\Application.vi
    Now consider the same VI built into a stand-alone application named MyApplication.exe. When running, the Current VI's Path function returns:
    C:\MyApplication.exe\Application.vi
    Therefore,
    when you have an executable, you must strip the path twice to get to
    the owning directory.  To write a VI which will return the current
    directory both as a VI and after being built into a stand-alone
    application, use LabVIEW's Application Kind or Application Name properties to determine in which environment the VI is running. "
    Hope this helps!
    Warm regards,
    Karunya R
    National Instruments
    Applications Engineer

  • Photoshop CS5 save with same name to a folder, also smartsharpen?

    I thought this would be easier, just trying to save a file down with its current filename to a folder.
    On a side note I couldn't see the option in the Library for Smart Sharpen (not the unsharp mask) Can this be done?
    Matt
    tell application "Finder"
              set highResFolder to "Hal 9000:Users:matthew:Desktop:HR" as alias
              set lowResFolder to "Hal 9000:Users:matthew:Desktop:LR" as alias
    end tell
    tell application "Adobe Photoshop CS5.1"
      activate
              tell front document
                        delete layer "Original Image"
      flatten
      resize image resolution 300 resample method none
                        set myOptions to {class:JPEG save options, quality:12}
      save  in folder highResFolder as JPEG with options myOptions appending no extension without copying
      close the current document saving no
              end tell
    end tell

    Might have it!, still can't find the Smart sharpen so played with unsharp mask.
    tell application "Finder"
              set highResFolder to "Hal 9000:Users:matthew:Desktop:HR" as alias
              set lowResFolder to "Hal 9000:Users:matthew:Desktop:LR" as alias
    end tell
    tell application "Adobe Photoshop CS5.1"
      activate
              set myOptions to {class:JPEG save options, quality:12}
              tell front document
                        delete layer "Original Image"
      flatten
      resize image resolution 300 resample method none
      --sharpen image
      filter current layer using unsharp mask with options ¬
                                  {amount:80, radius:3.2, threshold:0}
      --insert save option           save  in folder highResFolder as JPEG with options myOptions appending no extension without copying
      save in file ((highResFolder as string) & name) as JPEG with options myOptions without copying
      --Save for all HR JPEGS
      --Prepare for Low RES by resetting image history
                        tell application "Adobe Photoshop CS5.1"
                                  set current history state of current document to history state 3 ¬
                                            of current document
                        end tell
      resize image width 1020
      resize image resolution 300 resample method none
      filter current layer using unsharp mask with options ¬
                                  {amount:80, radius:3.2, threshold:0}
      --add save to lowResFolder with same options
      save in file ((lowResFolder as string) & name) as JPEG with options myOptions without copying
      --close file
      close
              end tell
    end tell

  • Save as "web page, complete" .html file disappears when overwriting file with same name

    On Mac and PC using various versions of FireFox (including 29.0.1 on Win 7) the following occurs:
    "Save Page As" a page with several iFrames in the content. I use "Web page, complete" and name the file.
    Close FireFox. The .html file and accompanying folder are saved correctly. Then I open the file in FireFox and make some changes to fields in a form. Then "Save Page As" again and use the same name. It prompts to overwrite the existing file and I click Yes.
    Three out of four times the file is no longer there. The folder remains but the .html file is gone. Not in the trash or hidden, just gone.
    I know this sounds crazy but I have tested it on about 20 computers (both mac and various windows versions), all with different FF versions and different antivirus. The above scenario happens: always on 1 computer, occasionally (random) on 3, and hasn't been observed yet on the others.
    Has anyone encountered this before? Are there any antivirus or malware products that could cause this? Any settings in FF that could? Any thing about this page or frames that could cause it?

    I found the solution. Yes, the first time you replace a file it disappears altogether. Just save it again, and it will reappear with the updated date and time code in the directory you chose to save it in. I only wish this were the problem in Firefox v. 30, but that is worse now.

Maybe you are looking for

  • Modifying Cost of Goods Sold Workflow

    I am looking for suggestions or an example of using the OM Cost of Goods Sold Account workflow to modify the COGS account. Basically, I need to change 2 segments with the corresponding 2 segments from the customer bill-to Revenue ccid. An example or

  • .rmt file missing from firmware download

    The readme file included with the firmware download zip file states to look for a .rmt file. There are only .txt files and a .bin file in the zip file. Are the instruction wrong/obsolete or should there be a .rmt file in the .zip file or is the .bin

  • SAP BI - New Learner - Help Required

    Dear Friends I have started learning SAP - BI from a local traning center.  I would appreciate if you all could guide me on where I should start my learning from?  What training materials that I need to look into? what is the time i need to spend to

  • How to download SAP LOGO's from SE78 to Local Desktop

    Hi friends, I am trying to down load one of our diagram from SE78 to Local desktop, But in SE78 only Import option is there, Can anyone help me how to down load this logo into local desktop as a BMP File. Thnx Mohana

  • Broken PDF?

    First of all, first post, so nice to meet you all, and nice to be here as well. So here's the problem. I've been creating some pdf for my college assignment. Needless to say, Adobe Acrobat was one of the first choice for creating pdf. Therefore, i ch