Automating the filename prefix in Layer Comps to files...

Hi All
I'm hoping someone can help me with some automation. I have no real clue about scripting, I just know that clever things can be done, hopefully someone could point me in the right direction!
I'm superimposing some t-shirt designs onto images of blank t-shirts.
Each different colour T-shirt (15 colours) is on an individual layer, so I have 15 layers.
So to create 15 images of a given t-shirt design (one image for each colour shirt) I need to:
1) Import a design onto the top layer
2) Update all 15 layer comps
3) Hit the 'Layer Comps to Files' button
4) Put a unique identifier into the filename prefix field
5) Go to 1)
So I guess my question is this:
Can I automate any more of this? For example can I have the filename prefix pulled in from the Layer name? So I'd just name the top layer (with the design on) and PS would pull that layer name into the filename prefix field?
And can I update all those layer comps automatically (when I put the next design on) rather than selecting each one and updating manually?
Any help appreciated from a scripting novice!
Kind Regards
Mark

If you turn the top layer with the design into a smart layer then manually update the layer comps once and save the file as a template you can then use the menu item Layer-Smart Object-Replace Cotents... to change out the design in a way that would no longer require updating the layer comps. Changing the content of a smart object does not effect the layer comp status like adding a new layer would.
In the Layer Comps to Files.jsx if you find the line
var fileNameBody = exportInfo.fileNamePrefix;
and replace it with
var fileNameBody = app.activeDocument.layers[0].name;// top layer name
The script will no longer use the prefix from the dialog and instead use the top layer's name as the prefix.
To automate the whole process would require creating a custom script. The Layer Comps to Files script was not written to be called from another script.

Similar Messages

  • Multiple Layers Export in Clipping Mask (Without using Layer comp to files script)

    Man, Actually I am designer and create mobile case design. I have done mobile cover design preview in psd. so many layers created. Top layer-group Camera & button.  Second Layer-group different mobile  cover designs in clipping mask.. I want to export the preview (without using Layer comp to files). Means Single design to export without hiding the layers.... 30 design preview in single click....

    Mine don't even work.

  • Layer Comps To Files with no number count in the middle

    I have tried to find it and // it out with no success. I would like to have it when I "Layer Comps To Files" the it won't put the _0000_,_0001_, Etc.. in the middle of every file the comps are named acording ly so that when i do "Layer Comps To Files" i can add a bit to the front and the remainder of the comp name is enough i don't need count in the middle of the file.
    I had asked in a different post how to "Load Files to Stack..." could i instead have the "Layer Comps To Files" disreguard .png or .jpg in the end of the layer comp?
    SO in looking in to the script my self i know it has to be in this bit
                for ( compsIndex = 0; compsIndex < compsCount; compsIndex++ ) {                 var compRef = docRef.layerComps[ compsIndex ];                 if (exportInfo.selectionOnly && !compRef.selected) continue; // selected only                 compRef.apply();                 var duppedDocument = app.activeDocument.duplicate();                 var fileNameBody = exportInfo.fileNamePrefix;                 fileNameBody += "_" + zeroSuppress(compsIndex, 4);                 fileNameBody += "_" + compRef.name;                 if (null != compRef.comment)    fileNameBody += "_" + compRef.comment;                 fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|\\\r\\\n]/g, "_");  // '/\:*?"<>|\r\n' -> '_'                 if (fileNameBody.length > 120) fileNameBody = fileNameBody.substring(0,120);                 saveFile(duppedDocument, fileNameBody, exportInfo);                 duppedDocument.close(SaveOptions.DONOTSAVECHANGES);             }
    this little bit
    var fileNameBody = exportInfo.fileNamePrefix;
    fileNameBody += "_" + zeroSuppress(compsIndex, 4);
    fileNameBody += "_" + compRef.name;
    stood out but i'm no scripter so help

    I took a quick look at that script. for Windows it may not be too big of a deal, but for Macs, there is something in there that requires the file names. It's easy to break those scripts, so it might be better to write a script that removes the file name later. something like this, which assumes that there are no groups and the layer names only have one "." in them before the extension. I haven't tried this, as I'm don't have PS loaded on the computer I'm using.
    #target photoshop
    var doc = activeDocument;
    for(var i=0;i<doc.layers.length){
        doc.activeLayer = doc.layers[0];
        doc.activeLayer.name = doc.activeLayer.name.split('.')[0];

  • Layer Comps To Files - Export error: Could not complete this operation. There are no user slices

    I have been using the Export Layer Comps To Files scrips that ships with Adobe Photoshop CS5 for a while and found it very useful, apart from the numbers it automatically adds as a prefix to the layercomp name.
    A friend pointed me in the direction of a altered version of this scrips which removes the numbers and only exports the layer comp name, gerat I thought. Not great! After using this successfully for a while the scrip started to throw up errors whenever I attempted to export. Either "No layer comps found" or "Adobe Save for Web & Devices Error: Could not complete this operation. There are no user slices." As I knew there were layercomps for the first error and knew that I had not created any slices for the second error I was pretty miffed. Fortunately I had the foresight to make a copy of the original script from the Photoshop presets library.
    I have since deleted the offending script out of my presets folder and copied the original script back in however the error still persists. I constantly receive Adobe Save for Web & Devices Error: Could not complete this operation. There are no user slices. I have searched the forums and around the net to try and find a solution for this problem but none seem to present themselves. I am perplex how this error can persist when the original script is now being used.
    If there's is anyone out there who can help me resolve this I'd be most grateful. As I say I've tried to resolve this myself and am pretty computer savvy but this one has defeated me
    Thanks in advance

    The problem seems to be already solved, but I'm commenting this for future reference.
    This has happened to me too and I think I know what causes it.
    It happens when you...
    1) Do "Save for Web" with the "All User Slices" selected in the dropdown menu "Slices".
    (This can only be done with a file that has a user slice)
    2) Then try to use the "Layer Comp to Files" script to a file that doesn't have any slices.
    To avoid this you need to once open a file that "has" a user slice and save with
    the "All Slices" option in the "Slices" menu and then go back to the file you want
    to run the script to.
    When you run the script, the saved "Slices" option from the previous export seems to
    be used and causes an error when there are no user slice.
    I also found a fix to the script to avoid this error to come out.
    This can be also applied to the fix to "remove the numbers" added to the head of the
    exported file names.
    The number removal script goes something like this...
    var fileNameBody = exportInfo.fileNamePrefix;
    if (fileNameBody != "") fileNameBody += "_";
    fileNameBody += compRef.name;
    this should replace the "Layer Comps to Files.jsx" lines 188-190.
    In addition to that, the script below needs to be added below line 818 and line 863.
    (This line numbers are those before any alterations to the "Layer Comps to Files.jsx" script)
    var idSWsl = charIDToTypeID( "SWsl" );
    var idSTsl = charIDToTypeID( "STsl" );
    var idSLAl = charIDToTypeID( "SLAl" );
    desc4.putEnumerated( idSWsl, idSTsl, idSLAl );
    The line right above where the above script should be inserted should read as the following...
    desc4.putPath( id44, new File( exportInfo.destination + "/" + fileNameBody + ".png") );
    Actually it can be added any where after the "desc4" variable is declared but I specified just
    to make it simple.
    This sets the "Save for Web" "Slices" settings to "All User Slices".

  • Weird numbers when Exporting Layers to Files / Layer Comps to Files

    Hi there,
    File > Scripts > Export Layers to Files ...
    File > Scripts >  Layer Comps to Files ...
    File > Scripts >  Layer Comps to PDF ...
    File > Scripts >  Layer Comps to WPG ...
    After I use each of these Scripts , even if I specify "File Name Prefix:", in the name of the exported files I see strange nomeration. This is pretty confusing , because each time I have to rename the files to remove these numbers.
    Adobe please remove the numbers prefix that these Scipts adds..
    Thanks!
    Regards,
    SK

    Hi. You’ve posted your question in a forum that is for beginners trying to learn the basics of Photoshop.  I'm moving your question to the Photoshop General Discussion forum for specialized attention to your situation.

  • Remove Digits from Layer Comp to Files Export

    Hello,
    Is there a quick way to remove the beginning of the string when running the Layer Comps to Files script? For example if the layer comp is named picture-of-tree, the exported files have _00001_picture-of-tree. I just need the resulting file name to be what is exactly in the layer comp text title: picture-of-tree.
    Any info would be great.

    jerseygirl505 wrote:
    How can I edit the code so that:
    - not only are there no numbers, the "_" is gone too... right now, with deleting that zeroSuppress line, the files are saving as "_filename_layercompname.jpg"
    OR
    - if I do choose to include the numbering, but want the numbers to start at 01 instead of 00?
    Thanks!
    Just removing line 189 "fileNameBody += "_" + zeroSuppress(compsIndex, 4);" will only remove the 4 digit numbers and it’s leading underscore. Your result might be caused by an empty file name prefix.
    If you would like to have the numbering start at 01 with two digits only - you simply have to change the zeroSuppress function call:
    fileNameBody += "-" + zeroSuppress(compsIndex+1, 2);
    The first parameter "compsIndex+1" will force to start with 1 instead of 0.
    The second parameter "2" does control the number of digits returned by the function.
    I already adopted your idea of starting with 01 in my version of the script:
    http://dl.dropbox.com/u/1037999/Adobe%20Scripts/Layer%20Comps%20To%20Files.jsx

  • HOW TO REMOVE HYPHEN IN LAYER COMP EXPORT FILE

    HOW TO REMOVE HYPHEN IN LAYER COMP EXPORT FILE IN PNG FORMAT...

    I ususally do that type of thing with a state machine... read a token, look for what is next, and if it's the closing token, I don't write it out. You have well defined opening token syntax and closing token syntax, so it should be relatively easy.

  • Layer Comp to Files in CC 2014 is SLLLLOOOOOWWWWW

    I updated to CC 2014 from CC when it first was announced but today was the first time I have had to export out my site design via the Layer Comps to File Script that I have loved to use for years. It has saved me so much time when I am working on sites with 20-40 pages. That being said I was startled by the slow speed I noticed instantly with CC 2014.
    So I figured I'd do a little test:
    My Machine:
    15" Macbook Pro running Mac OS 10.8.5
    2.6GHZ intel Core i7
    16GB 1600mhz DD3
    256GB SSD
    Using the same 287MB PSD with 24 Layer comps - here are the times to save out each layer comp as a JPG at 8 quality using the script.
    CC: 31 Seconds
    CC 2014: 3 minutes and 7 Seconds
    All my performance settings are identical between the two so I have no idea how it can be a 2.5min difference. I almost feel like I should just default back to CC at this point.
    Has any one experience this same thing, or have any clue why CC 2014 it is going so slow compared to CC?
    EDIT:
    After chatting with a fellow designer, we came to the hunch that it might be do to the new Smart Object Layer comps feature in 2014. Even though I am not using the functionality in my PSD, I would guess PS needs to make that YES/NO check on each and every smart object through out my PSD. I would guess I have 20 or so smart objects. Which I would assume would slow down the process a bit, and when you have 24 times instances of making multiple checks it could add up quickly...
    Thanks!

    Mine don't even work.

  • Error Layer comps to files. Layer not available?

    Sometime when I use "Scripts/Layers Comp to Files...", I have this error:
    Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
    - The object "layer comp 952649985" is not currently available.
    It arrived when I have more then one files open. In Standard Screen Mode. In 2 Up Tile.
    When I close all the open files except the one I will create PNG with, the script works fine.
    To me, it seems that the script lose the original file and the focus move to another open file where Photoshop can't find the Layer Comp.
    I have CS5 Version 12.1x64. I'm on Windows Seven.

    The problem seems to be already solved, but I'm commenting this for future reference.
    This has happened to me too and I think I know what causes it.
    It happens when you...
    1) Do "Save for Web" with the "All User Slices" selected in the dropdown menu "Slices".
    (This can only be done with a file that has a user slice)
    2) Then try to use the "Layer Comp to Files" script to a file that doesn't have any slices.
    To avoid this you need to once open a file that "has" a user slice and save with
    the "All Slices" option in the "Slices" menu and then go back to the file you want
    to run the script to.
    When you run the script, the saved "Slices" option from the previous export seems to
    be used and causes an error when there are no user slice.
    I also found a fix to the script to avoid this error to come out.
    This can be also applied to the fix to "remove the numbers" added to the head of the
    exported file names.
    The number removal script goes something like this...
    var fileNameBody = exportInfo.fileNamePrefix;
    if (fileNameBody != "") fileNameBody += "_";
    fileNameBody += compRef.name;
    this should replace the "Layer Comps to Files.jsx" lines 188-190.
    In addition to that, the script below needs to be added below line 818 and line 863.
    (This line numbers are those before any alterations to the "Layer Comps to Files.jsx" script)
    var idSWsl = charIDToTypeID( "SWsl" );
    var idSTsl = charIDToTypeID( "STsl" );
    var idSLAl = charIDToTypeID( "SLAl" );
    desc4.putEnumerated( idSWsl, idSTsl, idSLAl );
    The line right above where the above script should be inserted should read as the following...
    desc4.putPath( id44, new File( exportInfo.destination + "/" + fileNameBody + ".png") );
    Actually it can be added any where after the "desc4" variable is declared but I specified just
    to make it simple.
    This sets the "Save for Web" "Slices" settings to "All User Slices".

  • Layer Comps to Files v2.0 - Error

    I used to have an extension for Photoshop where, similar to the Layer Comps to Files, would export not only layer comps in a file but of an entire folder from your finder. Once I got creative cloud, that extension disappeared - when I try to install it, it says "The Extension can not be installed, it requires Photoshop version 10.0 or greater."
    I'm using the Layer Comps Toolkit extension for Layer Comps to Files v2.0
    Does anyone know how to solve this problem and help me get the extension back in my actions panel? Thanks in advance!

    I think you should contact the makers of the Action or whatever it actually is/comprises of.

  • Exporting Layer Comps to Files

    I am trying to Export Layer comps to file to make a pdf of a 38 page document.
    When try to export to jpg or png the files are too small, even on the highest setting.
    When I try to export to tiff or psd, it doesn't flatten the files and gives me files just as large as the master file.
    When I try to export to pdf it creates very large files, that do not seem high quality.
    Are there any more options or perhaps an additional script for exporting layer comps to files?
    Thanks

    Which OS and version of Photoshop I see that CS5 ships with a script named "Layer Comps To Files.jsx"
    And CS6 ships with that  one and one named "Layer Comps To PDF.jsx"
    Have never use them myself

  • Layer Comps to Files as Part of Action

    Hello,
    I use Layer Comps to create many different color combinations in my PSD files, and then use Layer Comps to Files to export them as individual PNG. This works just as I want, but I would like to run this as a batch on multiple files. When I use the script as part of an action, I get the message "Reference Error: dlgMain is undefined". This works perfectly fine with no error when exporting to JPG, but I need PNG to work so is there a way to alter the script to fix this?
    Thanks,
    Justin

    If I was right and you tried recording using the script in an action. If that step does not contain recorded dialog setting you can see in the action step when you expand the action step.  The script is not coded as a Plugin the script does not have action support coded in.  To fix it you would need to add plug-in code required for action support.
    Script that are Plug-in are usually listed in menu File>Automate>Name these can be recorded in actions they have code in them to record the setting used in their Dialog into the action step your  recording. When the recorded action is played the scripts dialog will only be displayed and interactive if you turn on the steps dialog in the action.   The Dialog setting are always retrieved from the Action step being played and set into place.  If you did not turn on the action step dialog the dialog will not be displayed.  If you turned on the dialog in the step the dialog will be displayed with the recorded setting in place.  The step interactive requiring user intervention.
    Some of Adobe Plug-ins are implemented with Photoshop scripting in JavaScript.  Contact Sheet II. Conditional Mode Change, Fit Image, Lens Correction, Merge to HDR Pro, Photomerge.   You can also add your own.  Scripts came be executed from any folder however to be listed in Photoshop menus they need to be in Photoshop  Install Tree or Linked into If and contain some special indemnification code.

  • Layer Comp To Files, JPG Compression?

    Hi
    So I have set up an action to  use Layer Comp To Files to save out  multipile jpg, and I have noticed the file compression is allot larger compared to the, Save for web option. Is there anyway I can use Layer Comp To Files in an action, but then use the Save for web option to get better compression for the final file export?

    Save as jpg and save for web are different animals. Save as assumes print and saves a preview and much less compression resulting in larger files... But you know that. Did you try making an action? It should work just fine, unless I'm missing something. Record your action while you go through the process. Is it the final step that is the issue? I'm not in front of my computer.... Like normf said, you could then batch them at the end for smaller jpgs.
    What version are you using? Do you know about naming your layers and they will save as web assets? I'm assuming you are using layer comps because your images are made up of multiple layers...

  • How do you remove the number sequence when exporting layer comps to files? CS6. Windows 8.

    Hi
    I remember in CS5 there was a script you could change, but I can't remember what it was called or where it was saved.  Can anyone help please?
    I would like to stop Photoshop automatically adding a number prefix to exported layer comps.
    Thanks

    So I've found a bit in the script that I think might be it (below).  Can I remove that whole bit?  Or would changing the 4 to a 0 do the trick (I tried and it didn't do anything)... Sorry, but I'm not a coder so don't really know if I'm barking up the wrong tree or not.
    Thanks
    for ( compsIndex = 0; compsIndex < compsCount; compsIndex++ ) {
                    var compRef = docRef.layerComps[ compsIndex ];
                    if (exportInfo.selectionOnly && !compRef.selected) continue; // selected only
                    compRef.apply();
                    var duppedDocument = app.activeDocument.duplicate();
                    var fileNameBody = exportInfo.fileNamePrefix;
                    fileNameBody += "_" + zeroSuppress(compsIndex, 4);
                    fileNameBody += "_" + compRef.name;
                    if (null != compRef.comment)    fileNameBody += "_" + compRef.comment;
                    fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|\\\r\\\n]/g, "_");  // '/\:*?"<>|\r\n' -> '_'
                    if (fileNameBody.length > 120) fileNameBody = fileNameBody.substring(0,120);
                    saveFile(duppedDocument, fileNameBody, exportInfo);
                    duppedDocument.close(SaveOptions.DONOTSAVECHANGES);

  • Changing the filename prefix or setting the starting number

    I have two PowerShots. I have been using one for years. My newer one sets the filenames with the same prefix, IMG, and starts numbering at 0001. Can I change this so I don't get duplicate filenames in my photo library. I realize that having the new photos in different folders will help to prevent overwriting the existing ones. I would like to prevent the confusion or possible overwriting by mistake.
    Thanks for any advice.

    Hi Apic13,
    To keep your camera from resetting the file numbers, press the MENU button and go to the settings tab, It's yellow and normally has a wrench and hammer on it.  Now scroll down to "File Numbering", then use the right or left arrow to choose "Continuous", then press the MENU button again.
    This may vary slightly from model to model.
    I hope this helps,
    Richard
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

Maybe you are looking for

  • Flash content doesn't display in browsers

    I recently updated Dreamweaver to 8.0.2. I updated an .swf file, updated the link on my DreamWeaver page and uploaded everything. When I saved the DreamWeaver page a window popped up that said it was modifying the html to work with the updated Intern

  • Can Change Object Placement Wrap Default Settings?

    I use a lot of text and image boxes in Pages. I would like the default setting in the Wrap pane in the Inspector to be "Floating" and the check box to be unchecked for "Object Causes Wrap." Most of the time I have to open up the Inspector to change t

  • Multi-Dimensional Arrays

    Greetings everyone, Currently I am working on a project for school, this is my first term in Java and a project we have been assigned to do is pretty much create a application (using the SDK for use on the computer only) and create a application wher

  • 16a  equity method,the investment is loss the positon came to zero

    Hi,experts We have trouble when our investment is came to zero,with equity method. In China GAAP ,The real business backgroud is our investment is equity method,not cost method. every year we will get the corporation 's profit or loss .And we shall c

  • Writing a String[] in one String

    Hi all, I tried to write this Method: public String stringFieldToString (String[] strf) But I cant get the Paramter String[]. following Error message apppeared: pze\InitServlet.java:72: stringFieldToString(java.lang.String[]) in pze.InitServlet canno