2 Replies Latest reply on Mar 28, 2009 3:18 AM by Peter Kahrel

    Win vs. Mac File Paths

    Really Randy Level 1
      I have a script that Peter Kahrel helped me with (actually he pretty much wrote the whole thing). The script saves out each page of an Indesign doc as jpeg. It also takes the text from a text box tagged "jobnumber" and inserts it into the name of the saved jpeg.
      It works great on the Mac. When I move it over to Windows it inserts a weird character before and after the "jobnumber".
      On the Mac I can take the folder name which is a variable called 'path' and insert that into the filename as well but it doesn't work on Windows. Does anyone know what the differences are between Mac and Win paths in JS? I tried a few things to no avail.
      Here's the script:

      ==========================================
      var path = Folder.selectDialog ("Choose a Folder")

      app.jpegExportPreferences.resolution = 72;
      app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;

      app.activeDocument.sections.everyItem().includeSectionPrefix = false;

      //path = app.activeDocument.filePath + '/';
      p = app.activeDocument.pages.everyItem().getElements();
      for (i = 0; i < p.length; i++)
      {
      jpg_name = p[i].textFrames.item ('jobnumber').contents + '.jpg';

      app.jpegExportPreferences.pageString = p[i].name;
      app.activeDocument.exportFile (ExportFormat.jpg, File (path + "/" + jpg_name));
      ===========================================

      As always, Thanks a million,

      Randy
      }