2 Replies Latest reply on Nov 4, 2013 8:56 AM by Peter Kahrel

    File Naming

    BEGINNER_X Level 3

      Hi All,

       

      I need to split my file naming.

       

      File naming looks like this:

       

      12345_00_020-037_s0_sd.indd      

       

      54321_00_040-085_s3_af.indd

       

      ISBN_Chapter Number_StartingPageNumber-EndPageNumber_Stage_ComposerName.indd

       

      My requirement is I need to get StartingPageNumber and EndPageNumber

       

       

      Trying things are below:

       

      var myDoc = app.activeDocument;

      var myDocName2 = app.activeDocument.name.replace(/_s0_sd\.indd$/i,'')

      alert("myDocName2: " + myDocName2)

       

      var myDocName3 = app.activeDocument.name.replace(/^(\d+_)/'')     //Here I got error

      var myDocName3 = app.activeDocument.name.replace(/^(\d{5})(_)/'')    //Here I got error

       

      alert("myDocName3: " + myDocName3)

       

       

      After that simply compare with

       

      app.activeDocument.pages[0].parentPage.name   &

       

      app.activeDocument.pages[-1].parentPage.name

       

      Finally get alert if anything mismatch.

       

       

      Could anyone please help for my request.

       

      Regards

      Beginner_X