How to really disable dialogs in scripts, and why would you save script parameters as playback parameters and run scripts as actions?

According to this docs (which I think are not official, but provide more info than the official ones, in certain case at least) and other posts on the web, app.displayDialogs = DialogModes.NO should disable the dialogs and alerts. However, I set this statement at the top of my main function of the script and the alert() calls still show the alert dialog and the script Window also shows.

  1. So, does this app.displayDialogs = DialogModes.NO still work, or maybe it only works in certain cases? Which?

I have a few more related questions

  1. What is the difference between Application.displayDialogs and Application.playbackDisplayDialogs. When should I use one over the other?

  2. Is there any difference between checking if app.displayDialogs === DialogModes.NO (equals to no) and checking app.displayDialogs !== DialogModes.ALL (no equals to all)? Same question for Application.playbackDisplayDialogs. I suppose there’s a difference because there’s also DialogModes.ERROR, but I cannot test this because it seems I can’t disable the dialogs at all.

  3. What exactly is playback mode? From what I’ve been reading, this is related to actions and only affects actions, but I’m not sure.

The script I’m working on used to save the parameters (a JS object, which is converted to an action descriptor), which control the behaviour of the script, in app.playbackParameters, i.e. app.playbackParameters = objectToDescriptor(<parameters-object>) and called app.putCustomOptions(<id>, <parameters-descriptor>); to save them. I think this is only necessary if you want to run a script later as an action. However, we don’t need to rerun the script with actions. We can just open the script dialog again and run the script again, instead of using actions, so I removed all this code that converts the parameters to descriptors and saves them to app.playbackParameters and app.putCustomOptions() because I think it’s unnecessarily complicated, if we don’t need it.

  1. Am I correct in assuming that I don’t need to convert the parameters to descriptors and save them in app.playbackParameters and by calling app.putCustomOptions()?

  2. What are the cases where you would want to save the parameters in app.playbackParameters and by calling app.putCustomOptions() to save them in some kind of registry (if I understand correctly)? I can save the parameters to a file and load them, if I need to, so I don’t understand why people use this complicated approach. I’d suppose it’s because they might also want to run the script as an action, which leads me to my last question.

  3. When would you ever want to run a script as an action (if this even makes any sense)?

I understand that actions are a sequence of recorded operations you take in photoshop, which you can play back to redo the operations (which is where the “playback parameters” probably comes from).

Here are my settings

  • ExtendScript
  • Photoshop version: 26.3.0
  • Scripting version: 26.3