Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Script to export all images in JPG

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #14328455

      Hi everyone,
      I’m a beginner in scripting, I’ve found this and change it to fit my needs, but I have 2 problems, I would like to remove the prefix with the myTargetName and number (just keep fileName + extension), and have the result saved in myTargetFolder
      Can anybody help me out?
      Thanks for your time
      var myDoc = app.activeDocument,
      apis = myDoc.links.everyItem().getElements(),
      items, fileName;
      var i = 0;
      var myTargetFolder = Folder.selectDialog(“Choisir le dossier dans lequel mettre les JPEG”);
      if (myTargetFolder != null)
      {}
      alert(“Ça travaille! Appuyez sur OK et attendez que ça soit terminé…”);
      while (items = apis.pop()) {
      items = items.parent.parent;
      if (!(items.hasOwnProperty(“graphics”))) {
      continue;
      }
      i++;
      try {
      fileName = File(items.graphics[0].itemLink.filePath).name;
      fileName = i + “_” + fileName.replace(/\.[a-z]{2,4}$/i, ‘.jpg’);
      } catch (e) {};
      app.jpegExportPreferences.exportResolution = 1000;
      app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MEDIUM;
      //give it a unique name
      var myFile = new File(myTargetFolder + fileName);
      items.graphics[0].exportFile(ExportFormat.JPG, myFile);
      }
      alert(“Terminé”);

Viewing 0 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads