Consecutive Numbering to New Documents

S
Posted By
sassvideo
Dec 29, 2008
Views
670
Replies
13
Status
Closed
I’m stumped.

A while ago I created an action which basically involves a) copying, b) creating a new document, c) pasting, and d) color correcting. In previous versions of PS, whenever I did this action and it got to part b) (creating a new document), the new doc would have a unique file name from the previous (consecutive numbering). However in CS4, every new document is given the same name (i.e. "Untitled-1") which wreaks havoc. Does anybody know how to fix this so that I can get my unique naming of new documents back?

NOTE: If I manually create new documents, the unique and consecutive numbering works fine. It is only when the new document is created from within an action that it does not work.

Thanks,

Daniel

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

CP
christoph_pfaffenbichler
Dec 30, 2008
Have You tried deleting the New Document-item from the recorded Action and replacing it with an »Insert Menu Item« of File – New?
S
sassvideo
Dec 30, 2008
Yes, I tried that and each new document is still opening with the same name:(
CP
christoph_pfaffenbichler
Dec 30, 2008
Just to make sure: When You click the triangle next to the »Make« in the Actions-panel what does it say?
And does the Action close the previous new Document before creating a new one or leave them all open?
S
sassvideo
Dec 30, 2008
Under "Make" it looks like this:

New: document
Preset: "Clipboard"

The Action does not close the previous new documents. They all are open with the same name (i.e. Untitled-1)

Thanks
CP
christoph_pfaffenbichler
Dec 31, 2008
The behaviour also occurs at my station if I record hitting command-N, whereas if I call up »Insert Menu Item« from the flyout-menu of the Actions-panel and select »File – New« it will number the new files correctly but the New File-dialog appears and I have to hit the backspace-key every time so that’s no good either …
I found a whack workaround though (which sometimes seem easier than trying to understand the mysterious behaviour of programs), namely entering a recording of »New« with some arbitrarily entered very small dimension (to minimize the time it takes) and closing that immediately before every iteration of the recorded »New« with the Clipboard-Preset.
Maybe someone can figure out why that helps?

Anyway: Could You explain in more detail the purpose and application of Your Action? Because maybe the copy-paste-part could be replaced with »Image – Duplicate« if it should be the whole image You copy.
S
sassvideo
Dec 31, 2008
Christoph,

First off, I truly appreciate the time you are taking trying to help me resolve my problem.

Next, here is the reason for the action. One of the things I do is picture montages, involving 100 or more pictures. Do speed up the time of getting the pictures scanned in, I scan 4 pictures at a time (the most that fill fit the scanner glass). Then, I open all of these docs, and I marque each particular picture and run the action. The action actually, copies, pastes, rotates, color corrects, and flatten the image. I do this relatively quickly. What I end up with is 100+ images sitting on my desktop, consecutively number in the order that I did them. Then all I have to do is "Close All" and hit Return about 200 times. Very easy. The problem I have now is that since all the new documents are opening with the same number, it messes up my automation with the "Close All."

The solution I have opted for was to reinstall Photoshop CS2, and use the older App just for this process.

Thanks,

Daniel
CP
christoph_pfaffenbichler
Dec 31, 2008
You’re welcome.

Have You tried using File – Automate – Crop and Straighten Photos to avoid having to marquee the individual images yet?

And saving 100 previously unsaved images should be able to be automated with a javascript … unfortunately I’m not a good scripter and anyway I’m off shortly but if I can come up with something or find an appropriate Script I’ll let You know.
S
sassvideo
Dec 31, 2008
I have to marquee them because there are 4 images in one doc that I have to pull off one at a time. (To speed up the scanning)

Thanks:)
CP
christoph_pfaffenbichler
Jan 1, 2009
Once again just to make sure: You know that the »Crop and Straighten Photos«-feature attempts to pick multi-image-scans apart?
Paul R has posted Scripts to automatically apply »Crop and Straighten Photos« to multiple Scans of multiple images and save the resulting files (as either jpg or tiff):
<http://www.adobeforums.com/webx?128@@.59b7368d>
<http://photoshoptechniques.com/forum/showthread.php?t=27131> (look for »ScanToFile.zip«)

Do the color-corrections You apply require individual input from You or are they applied to all the images the same?
CP
christoph_pfaffenbichler
Jan 2, 2009
Daniel, could You give this Script a try?
It should save all the open documents that have never been saved to the desktop; it provides a dialog to enter a name and then numbers the files.
One could also create a dialog to select a save-to-location but like I said I’m not a good Scripter.
Be careful though, if files of the same name and number should exist on the desktop they would be overwritten without alerting You; that could be avoided some conditional clauses … maybe I’ll try that later.

// this script is spposed to save all open documents that have never been saved as tiffs to the desktop;

#target photoshop

var myDocument = app.activeDocument;

var saveLocation = "~/Desktop/"

var theDocumentList = app.documents;

var theCount = 0;

//create dialog fo name-entry;

var dlg = new Window(‘dialog’, "save unsaved documents to the desktop", [500,300,880,420]);

//create the entry for the name;

dlg.msgPnl2 = dlg.add(‘panel’, [25,15,350,105], ‘please enter a name for unsaved documents’);

dlg.msgPnl2.msgEt = dlg.msgPnl2.add(‘edittext’, [15,20,305,40], "untitled_", {multiline:false});

dlg.msgPnl2.buildBtn = dlg.msgPnl2.add(‘button’, [13,50,158,65], ‘OK’, {name:’ok’});

dlg.msgPnl2.cancelBtn = dlg.msgPnl2.add(‘button’, [168,50,313,65], ‘Cancel’, {name:’cancel’});

//retrieve the selection;

var myReturn = dlg.show ();

if (myReturn == true) {

//get the name;

var theName = dlg.msgPnl2.msgEt.text;

//save tiffs;

for (var k = 0 ; k < theDocumentList.length; k++) {

try {var forgetThisVariable = theDocumentList[k].path}

catch (e) {

theCount = theCount+1;

tifOpts = new TiffSaveOptions();

tifOpts.embedColorProfile = true;

tifOpts.imageCompression = TIFFEncoding.TIFFLZW;

tifOpts.alphaChannels = true;

tifOpts.byteOrder = ByteOrder.MACOS;

tifOpts.layers = true;

app.activeDocument = theDocumentList[k];

theDocumentList[k].saveAs((new File(saveLocation+theName+zeroPad(theCount, 3)+".tif")), tifOpts, false, Extension.LOWERCASE);

}

}

}

else {};

// zerp-padding by paul r;

function zeroPad(n, s) {

n = n.toString();

while (n.length < s) n = ‘0’ + n;

return n;

};
CP
christoph_pfaffenbichler
Jan 2, 2009
I’ve tried to improve the two things mentioned in above post. Very probably it is still in bad form, but it seems to work for me, so if You haven’t tried the old one please try this Script instead, but be cautious and don’t risk Your original files:

// this script is spposed to save newly created documents that have never been saved as tiffs;

#target photoshop

var theDocumentList = app.documents;

var theCount = 0;

//dialog for target-folder;

var saveLocation = Folder(Folder.selectDialog("Select Folder to save to"));

//create dialog fo name-entry;

var dlg = new Window (‘dialog’, "save unsaved documents to the desktop", [500,300,880,420]);

//create the entry for the name;

dlg.msgPnl2 = dlg.add(‘panel’, [25,15,350,105], ‘please enter a name for unsaved documents’);

dlg.msgPnl2.msgEt = dlg.msgPnl2.add(‘edittext’, [15,20,305,40], "a_", {multiline:false});

dlg.msgPnl2.buildBtn = dlg.msgPnl2.add(‘button’, [13,50,158,65], ‘OK’, {name:’ok’});

dlg.msgPnl2.cancelBtn = dlg.msgPnl2.add(‘button’, [168,50,313,65], ‘Cancel’, {name:’cancel’});

//retrieve the selection;

var myReturn = dlg.show ();

if (myReturn == true) {

//get the name;

var theName = dlg.msgPnl2.msgEt.text;

//save tiffs;

for (var k = 0 ; k < theDocumentList.length; k++) {

// find out if file has a path and therefore doesn’t need to be saved;

try {var forgetThisVariable = theDocumentList[k].path}

// if file has no path save it to the target-location;

catch (e) {

theCount = theCount+1;

tifOpts = new TiffSaveOptions();

tifOpts.embedColorProfile = true;

tifOpts.imageCompression = TIFFEncoding.TIFFLZW;

tifOpts.alphaChannels = true;

tifOpts.byteOrder = ByteOrder.MACOS;

tifOpts.layers = true;

app.activeDocument = theDocumentList[k];

// if file with that name and number exists increase the count until the number is higher than the highest one found;

if (File(saveLocation+"\/"+theName+zeroPad(theCount, 3)+".tif").exists) {

while (File(saveLocation+"\/"+theName+zeroPad(theCount, 3)+".tif").exists == true) {

theCount = theCount+1

}

}

else {};

theDocumentList[k].saveAs((new File(saveLocation+"\/"+theName+zeroPad(theCount, 3)+".tif")), tifOpts, false, Extension.LOWERCASE)

}

}

}

else {};

// zero-padding by paul r;

function zeroPad(n, s) {

n = n.toString();

while (n.length < s) n = ‘0’ + n;

return n;

};
S
sassvideo
Jan 13, 2009
Christoph,

Thank you sooooo much for all your help and sorry for the delay in my response. I have just been finishing a big project.

I’ve decided that it is just the easiest to have a copy of Photoshop CS2 on my computer just for the montage creations. However, the links to the cropping scripts you previously sent me have been huuuge time savers.

Thanks again for all your help.

Daniel
CP
christoph_pfaffenbichler
Jan 14, 2009
You’re welcome.
When it comes to automating tasks and if one is willing to delve into JavaScript (or even AppleScript) the Photoshop Scripting forum is well worth checking out, because some extremely knowledgeable persons are prone to generously give their advice there.

How to Master Sharpening in Photoshop

Give your photos a professional finish with sharpening in Photoshop. Learn to enhance details, create contrast, and prepare your images for print, web, and social media.

Related Discussion Topics

Nice and short text about related topics in discussion sections