1 Reply Latest reply on Dec 11, 2012 5:56 AM by Muppet Mark

    Export PDF digits only

    davidDav

      Hi all,

       

      I am exporting Indd file to PDF, the file nameing is ABCDEFGHI_123456789_ADCD.indd,  I want the digits only as a file name in PDF after exporting

       

      I am having script for this, but it works only begining number not working for alphabets

       

      can onyone help me!

       

       

      var my_suffix = parseInt((app.activeDocument.name).substr(0,30))

       

      if (typeof (my_suffix) != 'number')

      {

      exit();

      }

              

      var myPresets = app.pdfExportPresets.everyItem().name;

      myPresets.unshift("- Select Preset - ");

      var myWin = new Window('dialog', 'PDF Export Presets');

      myWin.orientation = 'row';

      with(myWin){

       

          myWin.sText = add('statictext', undefined, '');

          pDrop = myWin.myPDFExport = add('dropdownlist',undefined,undefined,{items:myPresets});

          pSel = myWin.myPDFExport.selection = ("items:myPresets");

       

          bOK = myWin.btnOK = add('button', undefined, 'OK');

          bCan = myWin.btnCancel = add('button', undefined, 'Cancel');

          };

       

      bOK.onClick = function () { pDrop.selection == 0 ? alert ( "Please select valid PDF Preset!" ) : myWin.close ( 1 );};

         

      myWin.center();

      var myWindow = myWin.show();

      var myOutFolderPathName = "/Users/wleastudio/Desktop/Watched Folder/Out/"; //Please change your path as per requirement

      var myPDFFilePath;

          myPreset = myWin.myPDFExport.selection.index;

      var InDJobOption = app.pdfExportPresets[myPreset-1];

         

      myPDFFilePath = myOutFolderPathName+"/"+ (my_suffix) +".pdf";

      if(myWindow == true && myWin.myPDFExport){

      app.documents[0].exportFile (ExportFormat.pdfType, myPDFFilePath, false, InDJobOption);

          var myPreset = app.pdfExportPresets.item;

          myFile = File(+"PDF files: *.pdf");

       

      }

       

       

      david