• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

save for web: Error 1242

Engaged ,
Apr 20, 2018 Apr 20, 2018

Copy link to clipboard

Copied

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

activeDocument.flatten();

// save for web

SaveForWeb(myFile);

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.

TOPICS
Actions and scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Apr 20, 2018 Apr 20, 2018

Change:

activeDocument.exportDocument(fname, ExportType.SAVEFORWEB, sfwOptions);

To

activeDocument.exportDocument(File(fname), ExportType.SAVEFORWEB, sfwOptions);

Votes

Translate

Translate
Adobe
Guide ,
Apr 20, 2018 Apr 20, 2018

Copy link to clipboard

Copied

LATEST

Change:

activeDocument.exportDocument(fname, ExportType.SAVEFORWEB, sfwOptions);

To

activeDocument.exportDocument(File(fname), ExportType.SAVEFORWEB, sfwOptions);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines