2 Replies Latest reply on Sep 22, 2010 12:45 PM by behrk2

    Help selecting value from a dropdown box

    behrk2

      Hello,

       

      I am developing a script (using JavaScript) that will allow a user to select a PDF Export Preset (all of which are loaded into a dropdown box) and then export the InDesign file to a PDF, using the selected PDF Preset.

       

      I have the dropdown box populating correctly, and I am also able to export to PDF correctly, however I am having trouble setting the Preset to what was selected by the user. Here are some of my code fragments:

       

      Dropdown Box:

       

      with(borderPanels.add()) {

           pdfDD = dropdowns.add();

           sl = new Array();

           for (i = 0; i < app.pdfExportPresets.length; i++)

           sl.push(app.pdfExportPresets[i].name);

           pdfDD.stringList = sl;
           pdfDD.selectedIndex = 0;

      }

       

      ...

       

      myPreset = pdfDD.selectedIndex;

       

       

      To PDF:

       

          // Open, Export, & Close
          for (i = myFileAmount; i >= 0; i--) {
              app.open(File(myFolderContents[i]));

              createHyperlinks();

              app.activeDocument.exportFile(
              ExportFormat.pdfType, File(myFolder.fsName + "/" + app.activeDocument.name.split(".indd")[0] + ".pdf"), false, myPreset);
              app.activeDocument.close(SaveOptions.no);
          }

       

       

      When I pass myPreset, it is set as 6 (the index in the dropdown box).  How can I set myPreset to be the actual value of what was selected?

       

      Thanks!