Home  •  Next Meeting  •  Contact Us  •  iCal  •  Check Email

MacGroup-Detroit    MacGroup iBBS    MacGroup iBBS  Hop To Forum Categories  Photoshop SIG    Layer Comps to Files... w/o numbers
Go
New
Find
Notify
Tools
Reply
  
Layer Comps to Files... w/o numbers
 Login/Register
 
Jedi Knight
Picture of Scott
posted
Whenever I use the File/Scripts/Layer Comps to Files... feature in Photoshop, by default it places a series of numbers in front of the file name. For example, a Layer Comp named "01_D_Brinker" comes out named "_0000_01_D_Brinker".

In the Layer Comps to Files dialog box, the entry field "File Name Prefix" is blank. Does anyone know how to stop it from adding the extra numbers?

Thanks


"Where's the RAM."
 
Posts: 173 | Location: Detroit | Registered: July 18, 2006Reply With QuoteReport This Post
iBBS Addict
posted Hide Post
What version of Photoshop and Mac OSX?
 
Posts: 1655 | Location: Oak Park, MI, USA | Registered: January 31, 2004Reply With QuoteReport This Post
Jedi Knight
Picture of Scott
posted Hide Post
Photoshop CS5

Mac OSX 10.6.4


"Where's the RAM."
 
Posts: 173 | Location: Detroit | Registered: July 18, 2006Reply With QuoteReport This Post
Jedi Knight
posted Hide Post
I use this feature a lot and have tried everything I can think of to figure it out to no avail. It's been doing this in the 2 previous versions of PS that I have used also.
 
Posts: 420 | Location: greater detroit area | Registered: November 28, 2004Reply With QuoteReport This Post
Jedi Knight
Picture of Scott
posted Hide Post
Yep, me too. All I know to do is to go to each individual file and delete the numbers. There's got to be a better way.


"Where's the RAM."
 
Posts: 173 | Location: Detroit | Registered: July 18, 2006Reply With QuoteReport This Post
Jedi Knight
Picture of Scott
posted Hide Post
I'm tempted to offer a reward on this one. Anyone have any ideas?

See the image. The files on the left are as the should be. The files on the right are how the script outputs them.


"Where's the RAM."


 
Posts: 173 | Location: Detroit | Registered: July 18, 2006Reply With QuoteReport This Post
iBBS Addict
Picture of James R. Cutler
posted Hide Post
/Applications/Adobe Photoshop CS5/Presets/Scripts/Layer Comps To Files.jsx is the script invoked. See your friendly javascript Guru for help.

The goal is to remove the prefix and underscore from the front of the fileNameBody.

I can't test this without layer comps, but a possible edit is shown below. Save the modified script to your desktop and browse to it for testing. Don't forget the .jsx extension.

Old:
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);

New:
var fileNameBody = exportInfo.fileNamePrefix;

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);

This message has been edited. Last edited by: James R. Cutler,
 
Posts: 1979 | Registered: January 02, 2003Reply With QuoteReport This Post
Jedi Knight
Picture of Scott
posted Hide Post
James, very very close!!! It still ads a underscore to the front of the file. What part of the code will eliminate that?


"Where's the RAM."
 
Posts: 173 | Location: Detroit | Registered: July 18, 2006Reply With QuoteReport This Post
iBBS Addict
Picture of James R. Cutler
posted Hide Post
Now you understand why software developers should request and appreciate code review and testing.

quote:
Old:
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);

New:
var fileNameBody = exportInfo.fileNamePrefix;

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);


Newer: --- see the second non-null line ---

var fileNameBody = exportInfo.fileNamePrefix;

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);[/quote]
 
Posts: 1979 | Registered: January 02, 2003Reply With QuoteReport This Post
Jedi Knight
posted Hide Post
I'm impressed!
 
Posts: 420 | Location: greater detroit area | Registered: November 28, 2004Reply With QuoteReport This Post



Jedi Knight
Picture of Scott
posted Hide Post
That gives me a syntax error...


"Where's the RAM."


Error Message
 
Posts: 173 | Location: Detroit | Registered: July 18, 2006Reply With QuoteReport This Post
Guru
Picture of Jack Beckman
AIM: Online Status For jcbeckman@mac.com
posted Hide Post
Take off the [/quote]


===
Professor Hubert Farnsworth: “Nothing is impossible. Not if you can imagine it. That’s what being a scientist is all about.”
Cubert J. Farnsworth: “No, that’s what being a magical elf is all about.”

 
Posts: 5470 | Location: Sterling Heights, Mi | Registered: January 25, 2004Reply With QuoteReport This Post
iBBS Addict
Picture of James R. Cutler
posted Hide Post
Sorry about that. Cut and Paste strikes again. And, I was only looking at the code I changed, so I missed my gift from the iBBS.
 
Posts: 1979 | Registered: January 02, 2003Reply With QuoteReport This Post
iBBS Addict
Picture of Calvin
posted Hide Post
quote:
Originally posted by James R. Cutler:
Sorry about that. Cut and Paste strikes again. And, I was only looking at the code I changed, so I missed my gift from the iBBS.


I don't know ... you went from "impressive" to losing the gift. Just doesn't seem fair James.


Calvin Carson

^^^^^^^^^^^^^^^^^^


"portions of todays programming are reproduced by means of electrical transcriptions or tape recordings."

"....Mailbox!....Open.......... MailBox!"

"I was exposed to the GUI and have been stuck ever since!"

"Remember.. Under our clothes...we are all naked"
 
Posts: 1727 | Location: Detroit,MI,USA | Registered: June 10, 2002Reply With QuoteReport This Post
iBBS Addict
Picture of James R. Cutler
posted Hide Post
 
Posts: 1979 | Registered: January 02, 2003Reply With QuoteReport This Post
  Powered by Social Strata  
 

MacGroup-Detroit    MacGroup iBBS    MacGroup iBBS  Hop To Forum Categories  Photoshop SIG    Layer Comps to Files... w/o numbers

© MacGroup-Detroit 2016

Next Meeting | Join Now | News | About MacGroup | Check Your Mail