Skip to main content
namodayab94056659
Known Participant
April 26, 2019
Question

When checking the availability of 'Save for web' incompatible color mode error occurs.

  • April 26, 2019
  • 2 replies
  • 501 views

I can check the availability of Save for web option using following script.

app.displayDialogs = DialogModes.NO; 

function check_s4w() 

    try { 

        var d = new ActionDescriptor(); 

        var d1 = new ActionDescriptor(); 

 

        d1.putEnumerated(charIDToTypeID("Op  "), charIDToTypeID("SWOp"), charIDToTypeID("OpRe")); 

 

        d.putObject(stringIDToTypeID("using"), stringIDToTypeID("SaveForWeb"), d1); 

        var ret = executeAction(stringIDToTypeID("export"), d, DialogModes.NO); 

 

        return ret.count?true:false; 

        } 

    catch (e) { return false; } 

}

When the executeAction API is executed in above script, following error message was occurred if the Save for web option is not available.

I want to suppress the occurring above error message.

Even if DialogModes.No argument was given to above executeAction API, above error message was occurred.

Can anyone please help me?

This topic has been closed for replies.

2 replies

Chuck Uebele
Community Expert
Community Expert
April 29, 2019

If your code is in a try/catch block, and you're still getting the  message, then I would do sort of what r-bin suggested and put some code in to change it to the color mode that is acceptable. I'm not sure if it's still this way, but if you try and change to sRGB when you're already in that mode, it will throw an error. So the try catch block is good for that.

Chuck Uebele
Community Expert
Community Expert
April 29, 2019

Have you tried putting the code in a try/catch block?

namodayab94056659
Known Participant
April 29, 2019

It is already in try-catch block. Would you please explain me?

Legend
April 29, 2019

You can change the title and text of the message.

localize("$$$/S4W/Alert/ModeNotSupported=Ha-ha");

localize("$$$/S4W/Alert/Error/Title=Hee-hee");

check_s4w();