Incremental Numbering for File Names

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.

I got the script working. Took out some of the superfluous steps. Here it is in case anyone is curious:
// This script will save the active document to a folder with an incremental sufix
// Change the options below to match your needs
var saveFolder = new Folder( '/D/Civil War/Process/Screen Caps' );
var saveExt = 'tif';
var saveSufixStart = '_';
var saveSufixLength = 3;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.NONE;
tifOpts.alphaChannels = false;
tifOpts.layers = false;
// End of user options
//==========================================
function zeroPad ( num, digit ){
   var tmp = num.toString();
   while (tmp.length < digit) { tmp = "0" + tmp;}
   return tmp;
var docName = decodeURI ( activeDocument.name );
docName = docName.match( /(.*)(\.[^\.]+)/ ) ? docName = docName.match( /(.*)(\.[^\.]+)/ ) : docName = [ docName, docName, undefined ];
var saveName = docName[ 1 ]; // activeDocument name with out ext
var files = saveFolder.getFiles( saveName + '*.' + saveExt );// get an array of files matching doc name prefix
var saveNumber = files.length + 1;
alert("New file number: " + zeroPad( saveNumber, saveSufixLength ));
var saveFile = new File( saveFolder + '/' + saveName + '_' + zeroPad( saveNumber, saveSufixLength ) + '.' + saveExt );
activeDocument.saveAs( saveFile, tifOpts ,true ,Extension.LOWERCASE);

Similar Messages

  • How to add increment number to file name properly

    Hi, all:
    I have a simple question. As shown in the attached code, I need to add an increment number to file name and save the file. The problem is, if you run the code and put something like ".dat" in the extension name, you will see a blank space between the number and the dot in the file name. What should I do to eliminate the blank space? I can't specify the format of the file name since the file name would vary from case to case.
    Thanks a lot for any suggestion and correction in advance.
    Attachments:
    temp.vi ‏11 KB

    Hi,
    Please take a look to the attached VI. I hope that I understood what you really want.
    I've replaced the Vi: Format into string with Number to Decimal String plus a Concatenate String. 
    Now, this is working for me, I don't get a space anymore.  If something is wrong, please let me know.
    Regards,
    Paul
    Attachments:
    temp_back.vi ‏11 KB

  • Ver.9.5 The volume for file name cannot be found

    HI,
    My work Mac Book pro was recently upgraded to Mavericks from 10.6.8, with iPhoto 11 (ver. 9.5) also an included upgrade. One album of photos is no longer accesible - clicking on each thumbnail provokes the following window "The volume for <file name> cannot be found. The "Try again" option doesn't work, and the alternative, which is to use the finder to locate the file is useless, as the files are buried in a library spare bundle. When I copy the file name, and search on the volume with the library via finder, it pulls up tiny thumbnail size files.
    I have a primary iphoto library on a dedicated USB external drive, which I back up not everytime I update the library (200 gbs spare bundle over USB2!), but regularly. I fear these recently imported files, have not been backed up before up erasing cards, and upgrading system OS, have gone.
    Is there any way of getting into the library via finder, or elsewhere in iphoto to refind the original master files which are in there somewhere? These files opened perfectly in iphoto before the recent upgrade.

    Thanks for the fast response. I've followed your directions and can't find the file in there, in Masters, Originals, or Modified folders. I found files in Thumbnails folder though. Some of the files from the same event are fine, so its not consistent. I'm also noticing that another file in the event has a totally blurred preview (Its a 24mbs Jpg from a Nikon D800) - not sure if this is at all connected.
    The positive news is that my NeoFinder database of drives indicates I should have the 'missing' files on another computer in the office, but I'm still scratching my head on this.

  • " the volume for (file name) cannot be found. Insert the disk or connect to the server volume and wait for it to appear on the desktop, then try again."

    I get an error message in iPhoto when I click on thumbnails of pictures in certain albums. It reads 'the volume for "(file name)" cannot be found. Insert the disk or connect to the server volume and wait for it to appear on the desktop, then try again.'  What does this mean and how do I fix it?

    It means that you imported the files in Referenced mode and have now remvoed them from the Mac. Put the disk or card back.
    For more on iPhoto and file management see this User Tip:
    https://discussions.apple.com/docs/DOC-6361

  • F4 help for file name

    frnds,
    Im using the FM "KD_GET_FILENAME_ON_F4" to get F4 help for file name in presentation server... but it does not seem to work...Y?????????
    and is there any FM to get the file name from the application server..
    points assured to all the answers...
    regrds,
    Madan...

    Try to use WS_FILENAME_GET
      call function 'WS_FILENAME_GET'
        exporting  def_filename     =  space
                  def_path         = 
                    mask             = ',.  ,..'
                    mode             = 'O'
                    title            =  text-038
       importing  filename         =  os_name
                                  RC               =  DUMMY
       exceptions inv_winsys       =  04
                  no_batch         =  08
                                    selection_cancel =  12
                                    selection_error  =  16.
    or
    at selection-screen on value-request for p_file1.
      data wa_file like file_table.
      refresh filetable.
      call method cl_gui_frontend_services=>file_open_dialog
       EXPORTING
       WINDOW_TITLE            =
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
       FILE_FILTER             =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
       WITH_ENCODING           =
        changing
          file_table              = filetable
          rc                      = rc
       USER_ACTION             =
       FILE_ENCODING           =
      exceptions
        file_open_dialog_failed = 1
        cntl_error              = 2
        error_no_gui            = 3
        not_supported_by_gui    = 4
        others                  = 5.
      if sy-subrc = 0.
        if rc = 1.
          read table filetable into wa_file index 1.
          move wa_file-filename to p_file1.
        endif.
      endif.
    Max
    Message was edited by: max bianchi

  • Report Script : Parameter for file name?

    hi all,
    I am using a report script to generate a text file with budget data. This works fine in AAS console but I am automating this process by usning an ESSCMD and batch script.
    tha batch script will call the ESSCMD script which in turn executes the follwoing command
    RUNREPT 2 "RepScripName" "c:\Otputfile.txt"
    Now here I am hard coding the Output file name and location.But my requirement is that when I run the script it should prompt for file name and location.
    Any Idea on this
    Thanks

    Another solution I have tried is simply writing a small VB app that has a dialog that allows you to type in a file name or even navigate a file system directory. If I understand you correctly, you just want to be able to output the file anywhere you want. This works well and you can add more features to, just depends on if it is worth the effort. Other wise you can just write MXL and supply your script with position variables. You just need to type it in and hope you type typed it in correctly. Good luck, there are several ways to accomplish this.

  • Please add options for file names on camera or PlayMemories import (ie: 00001 DateTaken DSC)

    Please add options for file names on camera or PlayMemories import (ie: 00001 DateTaken DSC=   00001 2014_10_21 DSC )

    if(!getNewContactsName())
                   createNew();
                   return;
              if(!getNewContactsSurname())
                   createNew();
                   return;
              String checkName = newName;
              String checkSurname = newSurname;
              if(!checkIfDuplicate(checkName,checkSurname))
                   createNew();
                   return;
              if(!getNewContactsHomeNum())
                   createNew();
                   return;
              if(!getNewContactsWorkNum())
                   createNew();
                   return;
              if(!getNewContactsCellNum())
                   createNew();
                   return;
              if(!checkAtLeastOneNumEntered(newHome, newWork, newCell))
                   createNew();
                   return;
              }This can all be done in 1 if statement just use the or operator (||) will save some room
    private void deleteFromList(String nameOfContact, String surnameOfContact)
         {//Start of deleteFromList()
              int confirm = JOptionPane.showConfirmDialog(null,"Are you sure you wish to delete the contact from the phonebook?","Please confirm",JOptionPane.YES_NO_OPTION);
              if(confirm == JOptionPane.NO_OPTION)
                   return;
              elseWhy do you have a return statement in a void method? there's no need for this you can cut out the no part and just keep the yes

  • Internationalization support for File Names

    I want to know does it make sense to provide multilingual support for File Names. Say, I have a file called PurchaseOrder.pdf and it will be sent to users as an email attachment. We can localize the file name(for example, in Chinese: &#35746;&#21333;.pdf).
    But I want to know whether it is a standard to localize the file name. If not, should it be given in English, no matter which locale the user is using.
    Thanks in advance
    Edited by: Giritharan on Feb 1, 2010 1:53 AM

    ... hopefully you will not have to send another document to the same deliverer the very same day. Even if you add the minutes, a date tells you nothing about the contents. This is no problem as long as I receive nothing but purchase confirmations from you. But as a customer I will receive both sales confirmations and invoices, and then I think it's nice to see what the document is about.
    By the way, a person working in an international trading company is supposed nowadays to understand the English words "purchase, sale and invoice", isn't it? Maybe in 50 or 100 years from now Chinese will be the lingua franca. So be prepared for a change ;-)

  • ITunes appends incrementing number to file name

    Hi,
    I noticed that with some of my mp3 files iTunes 6 keeps on creating copies of them, appends an incrementing number to the file name and adds the new file to my iTunes library, which means I end up with multiple copies of the same song in my library.
    So if I have got a file called "03 All I Need.mp3" iTunes will create
    03 All I Need 1.mp3
    03 All I Need 2.mp3
    03 All I Need 3.mp3
    etc...
    Perhaps it could be related to the fact that I have got two computers accessing the same mp3 folder via a network?
    I really can't explain to myself why iTunes would be doing this, but it is terribly annoying, as I end up with the same song over and over again in my iTunes library.
    Does anybody know how I can prevent iTunes from doing that?
    Thanks heaps!

    Hi,
    Please take a look to the attached VI. I hope that I understood what you really want.
    I've replaced the Vi: Format into string with Number to Decimal String plus a Concatenate String. 
    Now, this is working for me, I don't get a space anymore.  If something is wrong, please let me know.
    Regards,
    Paul
    Attachments:
    temp_back.vi ‏11 KB

  • When saving to SharePoint 2010, we want Word to use document title for file name

    We have a template and custom Document information Panel.
    In the panel we select a few values to filter the selection list of document numbers. After selection of document number the title is populated from an external list of document numbers with titles.
    On initial save, the suggested file name provided by word is not the title that is already populated. If we cancel, and click save a second time the title is now the suggested file name.
    Is there a workaround or fix for this issue either for sharepoint or word? To make it use the title information on the initial save attempt?
    Thanks in advance,
    Chris.

    Hi  Chris,
    Do you use SharePoint Designer Workflow to get and  populate the document’s file name?
    If so, the  issue is caused by  delayed Workflow.
    For a workaround, you can create an event  receiver  with ItemAdding method for getting and populating the document’s file name.
    For more information, you can refer to the article:
    http://msdn.microsoft.com/en-us/library/gg749858(v=office.14).aspx
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Reading from a file. How to ask the user for file name at run time????

    I have the code to read from a file but my problem is how to prompt the user for the file name at run time.
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.util.InputMismatchException;
    import java.util.Scanner;
    public class FileRead {
        public static void main(String args[]) {
            Scanner scan = null;
            File file = new File("Results.txt");
            String number;
            try {
                scan = new Scanner(file);
                while (scan.hasNext()){
                number = scan.next();
                System.out.println(number);}
            catch (FileNotFoundException ex1){
                System.out.println("No such file");
            catch (IllegalStateException ex2){
                System.out.println("Did you close the read by mistake");
            catch (InputMismatchException ex){
                System.out.println("File structure incorrect");
            finally{
                scan.close();}
    }Any hints would be greatly appreciated. Thank you in advance

    I have read through some of the tutorials that you have directed me too and they are very useful, thank you. however there are still a few things that i am not clear about. I am using net beans 5.0 I have placed a text file named Results.txt into the project at the root so the program can view it.
    When I use the code that you provided me with, does it matter where the file is, or will it look through everywhere on the hard drive to find a match?
    This code compiles but at run time it comes up with this error
    run-single:
    java.lang.NoClassDefFoundError: NamedFile
    Exception in thread "main"
    Java Result: 1
    BUILD SUCCESSFUL (total time: 3 seconds)
    import java.util.Scanner;
    import java.io.*;
    class NamedFileInput
      public static void main (String[] args) throws IOException
        int num, square;   
        // this Scanner is used to read what the user enters
        Scanner user = new Scanner( System.in );
        String  fileName;
        System.out.print("File Name: ");
        fileName = user.nextLine().trim();
        File file = new File( fileName );     // create a File object
        // this Scanner is used to read from the file
        Scanner scan = new Scanner( file );     
        while( scan.hasNextInt() )   // is there more data to process?
          num = scan.nextInt();
          square = num * num ;     
          System.out.println("The square of " + num + " is " + square);
    }his is the code that i used. It is the same as the code you posted for me (on chapter 23 I/O using Scanner and PrintStream) Sorry im just really stuck on this!!

  • Automator script search document for file name, and rename file to date

    Hi all,
    I'm having a hard time with Automator... and I can't figure out how it's done!
    Searched the web for it a couple of times, spend hours with Automator already, but I guess my need is random!
    The thing is:
    I got a folder with 1066 files, all the files has random names.....
    I got a document (now it's html, but can convert it to PDF or txt or so ever....) with the coressponding random file names in the html.... some words before that there is the date the photo was taken in this format: 08/25/11
    Now I want somehow make automator search that folder each filename... match it in the document with the filename, and rename the files in the folder to the date the photo's were taken.... and that for all 1066 files.....
    anybody a great idea? Some help? I'm a real newby at Automator scrips!
    thanks

    Have you considered A Better Finder Rename 9?
    A Better Finder Rename 9: The Batch File Renamer for Mac OS X
    Otherwise, what you propose seems to be rather like carving the Pieta using a plastic butter knife. But, if you want, here's one example of a rough algorithm to start ...
    * translate the HTML to ASCII text in this format:  filename (date)
    * read one line at a time from the ASCII file
    * for each line, search the folder for the file
    * rename the file according to the (date)
    BTW, you might avoid a strict renaming according to just the date.
    Best luck with this project.
    JJW

  • Bug v4.0 - no input field for file name in export dialog

    Hello,
    I run a query, right click in the result grid and choose "Export". There is no input field to provide a file name. I can only export to the default file.
    Version 4.0.0.13 on XP
    Edit: Seems to be an issue with the settings (maybe those migrated from 3.2.2). When I install without migrating settings I get the full dialog. I will try some combinations and update this post.
    Edit: I installed again without migration my settings. When I set the preferences manually I cannot reproduce the bug. Maybe some bug in the import for the preferences? Maybe it only happens on German XPs.
    Regards
    Marcus

    Thank you, 5p given.
    However this is what I execute and in my file chooser dialog the filename field is still blank.
      ExampleFileFilter filter = new ExampleFileFilter();
        filter.addExtension("html");
        filter.addExtension("csv");
      JFileChooser chooser = new JFileChooser(new File("REPORT_ONE_"));
        chooser.setDialogTitle( "Save Report" );
        chooser.setFileSelectionMode(chooser.FILES_AND_DIRECTORIES);
        chooser.setFileFilter(filter);
        int returnVal = chooser.showSaveDialog(this);
        ...It is in try-catch, no errors are returned.
    Operating System: WindowsXP
    Java Version: 1.3.1

  • Split PDF and use field name for file name

    I have a pdf file with 333 pages that I will be splitting into 333 separate pfd files.  Each file needs a specific name that corresponds to a number located in the header of each individual page.
    Splitting the pdf is easy, unfortunately I can only use a static name for part of the file name and Adobe assigns the remaining portion with: _Part1.pdf; _Part2.pdf ect....  How can I get the "_Part1" to pull in the number located in the header of each individual page?
    I need to have this done before tommarow morning and there is another PDF which will be 555 files after it is split.
    Thanks for any help!

    Yes,
    I also know Profit Center field from R/3.
    However as I've mentioned....
    I need to ADD the field "Profit Center" in this TAB
    I do not even know if this field "Profit center" that I need to ADD is the same field from R/3.
    <b>You know....</b>
    I found "Profit Center"
    screen number: 0200
    program name: SAPLCRM_1O_MANAG_UI
    structure: ZCRMT_0200_BTX_UI01
    field name: ZZCUSTOMER_I0101
    data element: ZEEW_DATAELEMENT0101
    <b>However...</b>
    If I add this field above, the field does not display in the TAB I want. Meaning this field is not working.
    <b>For Instance:</b>
    In the same TAB (I want to add Profit Center), I have the field with:
    - description name field "Services Revenue"
    By pressing F1/Tech Info, I have:
    screen number: 0200
    Program name: SAPLCRM_1O_MANAG_UI
    Structure: ZCRMT_0200_BTX_UI01
    Field name: ZZCUSTOMER_I0101
    Does anyone has any idea to help me outto fimd Profit Center field?
    many thanks,
    Barb

  • Safari 5 stopped prompting for file name when downloading.

    Hello,
    On Safari 4, when I clicked a download link, Safari always prompted for a file name, so I could change it before starting downloading, I installed Safari 5 and "this" feature dissapeared. Can anyone help?
    Thank you in advance,
    Alex

    Works for me: Right-click on the Paint.NET download file here. http://www.dotpdn.com/downloads/pdn.html
    It opens a menu. I click Download Linked File As... and change the name. It downloads.
    What experience are you seeing?

Maybe you are looking for

  • Indesign keeps crashing on me and will no longer open, i have tried re installing it multiple times but it has made no difference, can anyone advise me on what i should do?

    Has anyone else had this issue? it has happened to me before and i ended up having to re do all the work i had already done on another computer and now its happened again before a really big deadline for one of my uni projects and i dont want to loos

  • Flash movie display

    hello i have built this site, www.emsworthcricketclub.com for internet explorer 8, and below, there is a short flash film. can anyone help me get rid of the horrible borders at the top? thanks malcolm

  • SD Integration in cProjects

    Hello, I am using cProjects with hierarchical accounting. The point I am not getting is the SD Module. The workflow is using cProjects to make the projects structure and then the PS structures is generated automatically by cProjects with the PS templ

  • How to apply RSA and MD5 on my data?

    Hello everyone...I am a college Student and I have a project two clients connected with server one of them by socket and another by RMI and I have been asked to apply CIA (confidentiality, integrity, availability) I know algorithms of cryptograpghy a

  • 24 Hour Clock on iCal

    My Time/Date Preferences on system preferences are set to the 24 hour clock and I thought that this flowed through to my iCal times. My times on iCal are now AM/PM. Is there a way to get it back to the other clock?