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

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

Explorer ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

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?

TOPICS
Actions and scripting

Views

385

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
Adobe
Community Expert ,
Apr 28, 2019 Apr 28, 2019

Copy link to clipboard

Copied

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

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
Explorer ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

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

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
People's Champ ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

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();   

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
People's Champ ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

It is easier to check in which color mode the current document is.

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
Community Expert ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

LATEST

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.

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