The CAFE

Last active: Never
Not logged in [Login - Register]
Go To Bottom

Now Available - Photoshop CS5 for Digital Photographers!

Printable Version
Subscribe | Add to Favourites

Post new thread
Author: Subject: CS2 Script > Export Layers to Files
Melchiah
coffee drinker
**




Posts: 6
Registered: 4/26/2006
Member Is Offline


posted on 4/26/2006 at 10:37 PM Reply With Quote
CS2 Script > Export Layers to Files



Hello,

I'm hoping someone can tell me how to prevent PS CS2 from adding information to my filenames that I don't want included, when I use the "Export layers to files" script.

I have my layers, I activate the script, and chose my options:


    Destination: <My folder of choice>
    File Name Prefix: Blaster -
    File Type: PSD
    Maximize Compatibility: Enabled
    Run Script


From my understanding, the resulting files should be named:


    Blaster - <Layer Name>.psd


This is what CS2 is actually naming my files:

    Blaster - _0000s_0000s_0000s_0000_<Layer Name>.psd
    Blaster - _0000s_0000s_0000s_0001_<Layer Name>.psd
    Blaster - _0000s_0000s_0000s_0002_<Layer Name>.psd
    Blaster - _0000s_0000s_0000s_0003_<Layer Name>.psd

So on and so forth, all the resulting filenames have that naming convention with a progressive number sequence, as shown above.

Is there a way I can tell CS2 to *not* do this to my filenames when using the "Export to Layers to Files" script?

Any assistance would be greatly appreciated.

If you'd like a screenshot of how I'm configuring the script options, or need any additional information, just let me know.

Thanks,
~Melchiah
View User's Profile View All Posts By User U2U Member
mkeefe
PhotoshopCafe Developer
******




Posts: 7620
Registered: 2/10/2003
Location: Boston MA, USA
Member Is Offline

Mood: Eager to code, hello Flex!

posted on 4/26/2006 at 11:42 PM Reply With Quote


Can you provide a screenshot? I wasn't aware of this file working like that :)

Matt




Dev: PHP, AS3, Flex and AIR
Work / Photography / twitter / Scriptplayground

http://mkeefe.com/s.jpg
View User's Profile E-Mail User Visit User's Homepage View All Posts By User U2U Member mkeefe's Aim
Melchiah
coffee drinker
**




Posts: 6
Registered: 4/26/2006
Member Is Offline


posted on 4/26/2006 at 11:49 PM Reply With Quote
Update



While awaiting any response from this forum, I've been messing around with CS2, and I've learned that the naming convention is somehow tied to 'layer groups.'

My layers palette looks like this, in terms of my groups:

Group 1
----->Subset 1
---------->Subset 1.1
---------->Subset 1.2
---------->Subset 1.3
---------->Subset 1.4
---------->Subset 1.5
----->Subset 2
---------->Subset 2.1
---------->Subset 2.2
---------->Subset 2.3
---------->Subset 2.4
---------->Subset 2.5

Each subset ranging 1.1 - 2.5 has 9 layers inside it.

That explains why I'm getting 4 sets of numbers in each filename:

Group 1 - (first series of "_0000s_")
Subsets 1 & 2 - (second series of "_0000s_")
Subsets 1.0 - 2.5 - (third series of "_0000s_")
Actual layer itself - (fourth series of "_0000s_)"

So, I completely ungrouped all the layers and ran the script again using the same parameters, this time my filenames were:

Blaster - _0000_<Layer Name>.psd
Blaster - _0001_<Layer Name>.psd
Blaster...sequenced through _0089_ for my 89 layers.

It seems ungrouping those removed 3 of the sets of numbers, but the 4th set remains, and I'm still not sure how to prevent it. I opened up the script (JavaScript) in Notepad to see if I could find where it was coming from, but since I don't understand JS, yeah...that didn't help me any.

Does anyone have any ideas on how I can solve this?

I could manually rename them, if this was the only file I'm processing, but it isn't...I have 12 files, each have approx. 89 layers. I don't want to manually rename that many files, lol.

I've looked into using 'Batch Rename" in Bridge (and ACDSee), but neither of them provide a method of extracting a few characters out of the filename while leaving the rest intact (unless I'm not using them correctly).

Again, any guidance would be greatly appreciated.

Thanks,
Melchiah
View User's Profile View All Posts By User U2U Member
Melchiah
coffee drinker
**




Posts: 6
Registered: 4/26/2006
Member Is Offline


posted on 4/26/2006 at 11:57 PM Reply With Quote


Quote:
Originally posted by mkeefe
Can you provide a screenshot? I wasn't aware of this file working like that :)

Matt


Sure, give me a few moments and I'll upload one to my site.

~Melchiah
View User's Profile View All Posts By User U2U Member
Melchiah
coffee drinker
**




Posts: 6
Registered: 4/26/2006
Member Is Offline


posted on 4/27/2006 at 12:01 AM Reply With Quote
Screenshots



Here are some screenshots:

Script Configuration

Layer Palette

Screenshot of Filenames
View User's Profile View All Posts By User U2U Member
mkeefe
PhotoshopCafe Developer
******




Posts: 7620
Registered: 2/10/2003
Location: Boston MA, USA
Member Is Offline

Mood: Eager to code, hello Flex!

posted on 4/27/2006 at 12:18 AM Reply With Quote


Ok open up the js file again "first save and close Photoshop" :)

Scroll on down to line: 706

It should be in the export function
Code:

fileNameBody += "_" + zeroSuppress(i, 4);


change it to
Code:

//fileNameBody += "_" + zeroSuppress(i, 4);


and you should be all set.

Matt




Dev: PHP, AS3, Flex and AIR
Work / Photography / twitter / Scriptplayground

http://mkeefe.com/s.jpg
View User's Profile E-Mail User Visit User's Homepage View All Posts By User U2U Member mkeefe's Aim
Melchiah
coffee drinker
**




Posts: 6
Registered: 4/26/2006
Member Is Offline


posted on 4/27/2006 at 12:40 AM Reply With Quote


Matt,

You're awesome! Thank you so much, that fix was perfect!

To prevent the first 3 sets of "0000s" I still have to ungroup the layers, but it did stop adding the set for the layers themselves, which is just great! It doesn't bother me to upgroup the layers to run the script then close without saving, so they remain grouped.

I have one more quick question for you, while I've got your attention, :)

Is there a way to gracefully stop a script while it's running?

I couldn't find a button to stop the script, and closing the file to stop the script generates errors, and then I have to reload PS to run anymore scripts, else I get a "Window does not have a construct" error message. If there isn't a means to accomplsih this, it's no biggy. I'm just curious about it since I figured the Adobe Devs would have built into the program a method to stop a script that takes a long time, for whatever reason you may need to end it, without generating errors or forcing a restart.

Thanks again for your help!!

~Melchiah

[Edited on 4/26/2006 by Melchiah]
View User's Profile View All Posts By User U2U Member
mkeefe
PhotoshopCafe Developer
******




Posts: 7620
Registered: 2/10/2003
Location: Boston MA, USA
Member Is Offline

Mood: Eager to code, hello Flex!

posted on 4/27/2006 at 12:52 AM Reply With Quote


Hit escape, it "usually" stops gracefully :)

Matt




Dev: PHP, AS3, Flex and AIR
Work / Photography / twitter / Scriptplayground

http://mkeefe.com/s.jpg
View User's Profile E-Mail User Visit User's Homepage View All Posts By User U2U Member mkeefe's Aim
Melchiah
coffee drinker
**




Posts: 6
Registered: 4/26/2006
Member Is Offline


posted on 4/27/2006 at 01:29 AM Reply With Quote


Thank you :)

~Melchiah
View User's Profile View All Posts By User U2U Member
mkeefe
PhotoshopCafe Developer
******




Posts: 7620
Registered: 2/10/2003
Location: Boston MA, USA
Member Is Offline

Mood: Eager to code, hello Flex!

posted on 4/27/2006 at 02:27 PM Reply With Quote


Glad to help... PS Scripting is pretty great.

Matt




Dev: PHP, AS3, Flex and AIR
Work / Photography / twitter / Scriptplayground

http://mkeefe.com/s.jpg
View User's Profile E-Mail User Visit User's Homepage View All Posts By User U2U Member mkeefe's Aim
john_porter
coffee drinker
**




Posts: 27
Registered: 4/29/2006
Member Is Offline


posted on 4/30/2006 at 02:23 AM Reply With Quote


:cheers



hi
http://levanhung.info/anh%20di%20up/ky1.gif
View User's Profile Visit User's Homepage View All Posts By User U2U Member john_porter's Yahoo
mrheeltoe
decaf
*




Posts: 1
Registered: 6/15/2007
Member Is Offline


posted on 6/15/2007 at 10:34 PM Reply With Quote


Quote:
Originally posted by mkeefe
Ok open up the js file again "first save and close Photoshop" :)

Scroll on down to line: 706

It should be in the export function
Code:

fileNameBody += "_" + zeroSuppress(i, 4);


change it to
Code:

//fileNameBody += "_" + zeroSuppress(i, 4);


and you should be all set.

Matt



So freakin' awesome, very glad for google directing me here!

Resurrecting thread with something to add:


This mod removes the number sequence, but there is still an underscore there. To make the file name the straight layer name change line 707 from

Code:

fileNameBody += "_" + layerName;


Code:

fileNameBody += "" + layerName;



Maybe I am stating something obvious, but I have never edited a script before and I am proud of myself :):):):)

Marcus
View User's Profile Visit User's Homepage View All Posts By User U2U Member
utersmom
decaf
*




Posts: 1
Registered: 7/23/2008
Member Is Offline


posted on 7/23/2008 at 08:03 PM Reply With Quote


This was my first attempt at Javascript editing and I found these posts SO incredibly helpful. I use CS3, and found the only difference was that the function appeared on lines 793 and 794 instead of 706 and 707.
After making the change I tested it out and it worked perfectly. This is a HUGE time saver. Thanks!
View User's Profile View All Posts By User U2U Member utersmom's Aim
Joshdr
decaf
*




Posts: 1
Registered: 5/15/2009
Member Is Offline


posted on 5/15/2009 at 07:29 PM Reply With Quote


I registered just to express my gratitude for this thread. That solution worked perfectly, thank you!
View User's Profile Visit User's Homepage View All Posts By User U2U Member
tonydanza666
decaf
*




Posts: 1
Registered: 7/31/2009
Member Is Offline


posted on 7/31/2009 at 06:58 PM Reply With Quote


Awesome stuff.

To get rid of the 0000s, so you don't have to ungroup ANY layers (I couldn't because of a global layer mask) then change this line . . .

fileNameBody += "_" + zeroSuppress(i, 4) + "s";

to this

// fileNameBody += "_" + zeroSuppress(i, 4) + "s";

Essentially just commenting it out I think. Worked great for me.

Thanks again for the help on this!
View User's Profile View All Posts By User U2U Member
Energyflash
coffee drinker
**




Posts: 3
Registered: 7/28/2010
Member Is Offline


posted on 7/28/2010 at 02:50 AM Reply With Quote


Hi, this is great, exactly the solution I need, however it doesnt work for CS5, any ideas? This is driving me nuts.

I have my PSDs, simply as layered files, no folders. The numbering thing is terrible.

Thanks in advance!
View User's Profile View All Posts By User U2U Member
Energyflash
coffee drinker
**




Posts: 3
Registered: 7/28/2010
Member Is Offline


bouncy.gif posted on 7/28/2010 at 04:29 AM Reply With Quote


Hi guys, another forum answered the question. The commenting out but using the // now occurs in line 1030
View User's Profile View All Posts By User U2U Member
Energyflash
coffee drinker
**




Posts: 3
Registered: 7/28/2010
Member Is Offline


posted on 7/28/2010 at 04:36 AM Reply With Quote


Oh yep, and the underscore can be removed in line 1031

by changing:

fileNameBody += "_" + layerName;

to

fileNameBody += "" + layerName;

Deleting the underscore in the parenthesis

This was solved by a champ user: Michael L Hale, at:
http://forums.adobe.com/message/3006825#3006825

Cheers to all

[Edited on 7/28/2010 by Energyflash]
View User's Profile View All Posts By User U2U Member
Post new thread


Go To Top


Version ( removed for security concerns )

[queries: 17]
[PHP: 81.7% - SQL: 18.3%]


PhotoshopCD