Skip to main content
Participating Frequently
May 14, 2013
Question

Incremental Numbering for File Names

  • May 14, 2013
  • 1 reply
  • 1423 views

I've been trying to wrap my head around this problem all day. So I've found two very helpful scripts on this forum: here and here. The second one works, but I'd like to be able to direct where the files are saving to and I'd like to save them as .tifs. It seems like the first script is exactly the one I want, but when I run it I get the following error (I have CS 5):

I'm trying to use this as a learning exercise, but man, it's a steep curve.

Thanks

jonathan.

This topic has been closed for replies.

1 reply

Inspiring
May 15, 2013

From that error message I would say that you have a bad file path. The saveAs() command will not create subfolders if they do not exists. At a guess you are trying to create a new folder and save to that folder in one step. You need to first create the folder, then you can save to it.

Or if the D: drive on your system is a CD/DVD drive then that may be the problem.

adraftAuthor
Participating Frequently
May 15, 2013

Thank you for your response. The script only works for me when I have it save to a folder, which is fine. For some reason specifying subfolders (already existing ones) brings up that error message again.

This will work for me, though. Thanks again.

Inspiring
May 15, 2013

var saveFile = new File( saveFolder + '/' + saveName + '_' + zeroPad( saveNumber, saveSufixLength ) + '.' + saveExt );

and for saveFolder I've got:

var saveFolder = new Folder( 'D:\Civil War\Process\Screen Caps' );

the script works when the path is D:\Civil War, but when I enter any subfolders I get the error.


The backslash in javascript is a special char used to escape the following char. So either use

var saveFolder = new Folder( 'D:\\Civil War\\Process\\Screen Caps' );

Or better yet avoid the unnecessary use of the special char.

var saveFolder = new Folder( '/D/Civil War/Process/Screen Caps' );