2 Replies Latest reply on Apr 9, 2010 10:25 AM by JoseBushfield

    Inserting a constant after a file name

    JoseBushfield

      Hello all,

       

      I have been working on a Javascript for Acrobat Pro 9, which I want to pull the first page of a PDF file & move it to another folder, I have managed to achieve this, however it would also be useful to insert an additional part to the file name...

       

      /* Extract Cover Page Only As PDF */
      // regular expression acquire the base name of file
      var re = /.*\/|\.pdf$/ig;
      var filename = this.path.replace(re,"");
      try {
      i=0;
      this.extractPages(
      {
      nStart: i,
      cPath: "/C/Documents and Settings/JBushfield/Desktop/Output/"+filename+".pdf"
      });
      } catch (e) {

      console.println("Aborted: "+e)

      }

       

      I can get the script to insert a prefix to the file name but when I try to move it to after the filename ie just before the .pdf it won't play ball. I talked a colleage, who suggested that maybe as the filename is (to Adobe) variable (it's actually always 13 digits as it is an ISBN), that maybe there is someway to include this, as in place text in name after the 13 digits but I am not sure.

       

      PS The text I want to include after the ISBN is "_Outside_Front_Cover"

       

      Any help on the matter would be greatly appreciated,

       

      Many Thanks

      Joe