1 Reply Latest reply on Apr 20, 2018 6:25 AM by SuperMerlin

    save for web: Error 1242

    Ghoulfool Level 1

      In Photoshop CC I'm having problems saving for web with a script.


      var srcDoc = app.activeDocument;
      var myFile = "D:\\temp\\process_images\\test.jpg";
      // Flatten the jpg
      // save for web
      function SaveForWeb(fname, myJpgQuality)
        if (!myJpgQuality) myJpgQuality = 100;
        var sfwOptions = new ExportOptionsSaveForWeb();   
        sfwOptions.format = SaveDocumentType.JPEG;   
        sfwOptions.includeProfile = false;   
        sfwOptions.interlaced = 0;   
        sfwOptions.optimized = true;   
        sfwOptions.quality = myJpgQuality;
        activeDocument.exportDocument(fname, ExportType.SAVEFORWEB, sfwOptions);


      The code gives me an error:

      Error 1242 Illegal argument - argument 1

      - File/Folder expected


      Which should be the case as I've just tested it with a smiliar function to save as jpect along same path. Any ideas - apart from deleting preferences which I'm really not looking forward to.


      Aslo if anyone can point me in the direction of the sRGB option I'd appreciate it.