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

Disable alerts in batch script?

New Here ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

How can I stop alerts from stopping my batch script?

I've found and adapted a script to do batch photomerges on a group photos that might be related. There's only one issue: Some of them aren't, and the photomerge script throws an alert ("Some images could not be aligned") and stops dead until I dismiss the dialog. That's...not automation. I tried to tell it to not display dialogs:

displayDialogs = DialogModes.NO;

alert('displayDialogs='+displayDialogs);

But that just doesn't work. (When you think about it, the second line shouldn't throw the alert telling me the value of displayDialogs, but it does).

I've tried various incantations:

app.displayDialogs

photomerge.displayDialogs

I've even put the DialogModes.NO into the photomerge script itself, but to no avail.

I guess I can perform surgery on the photomerge.jsx script itself, but all the documentation says that displayDialogs should work. I'm back on Photoshop CS6.

I also tried:

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract

but this appears to be for a different version, as it complains that UserInteractionLevels is undefined.

I am using python to open the com object and then:

object.DoJavaScriptFile("/N/Images/panoramas/photomerger.jsx", ["a", "b"])

photomerger.jsx starts:

var runphotomergeFromScript = true;

#include "/C/Program Files/Adobe/Adobe Photoshop CS6 (64 Bit)/Presets/Scripts/Photomerge.jsx"

displayDialogs = DialogModes.NO;

alert('displayDialogs='+displayDialogs);

...

photomerge.createPanorama(jpg_list, false);

I even tried to figure out how to override alert(), but I couldn't get that to work either.

Any ideas before I hack up the script?

Thanks!

TOPICS
Actions and scripting

Views

2.7K

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

LEGEND , Mar 08, 2018 Mar 08, 2018

If that is what you're asking for cannot you just comment alert in your script like this (Photoshop CS6 EXTENDED / line 461):

//alert(localize("$$$/AdobePlugin/Shared/Photomerge/alignbad=Some images could not be automatically aligned"));

Votes

Translate

Translate
Adobe
LEGEND ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

If that is what you're asking for cannot you just comment alert in your script like this (Photoshop CS6 EXTENDED / line 461):

//alert(localize("$$$/AdobePlugin/Shared/Photomerge/alignbad=Some images could not be automatically aligned"));

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
New Here ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

Thanks! Yes, my backup plan is to make a copy of the script and go in and rip out all of the alerts...or well, make the error returns that I could catch. But I would prefer to have a generic automation solution.

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 ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

a()

function a()

    {

    function alert() {}

    /////////// your main code start

    var runphotomergeFromScript = true;

    #include "/C/Program Files/Adobe/Adobe Photoshop CS6 (64 Bit)/Presets/Scripts/Photomerge.jsx"

    displayDialogs = DialogModes.NO;

    alert('displayDialogs='+displayDialogs);

    ///...

    photomerge.createPanorama(jpg_list, false);

    /////////// your main code end

    }

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
New Here ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

This only works in the outer level: It suppresses the

alert('foo');

but the alert in photomerge script still fires.

So I guess I could modify the photomerge script itself with this: It would be easier than changing all of the alerts themselves!

(I've tried for literally the last 90 minutes to set my preferences and/or see the thing that let's me paste code, but all I get is some stupid "We could not complete your request. Please check the form for details.", so...my apologies for the ugly post):

do_merge()

function do_merge() {

  function alert() {}

  displayDialogs = DialogModes.NO;

  alert('foo')

  photomerge.createPanorama(jpg_list, false);

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
New Here ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

LATEST

So in the end, I edited the Adobe script and changed all of the alert() calls to throw(), which I catch and then cleanup the active document. I guess that makes Kukurykus' answer the most correct...

Thanks for the help!

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