Hide Marching Ants

I have created a BatchPlay which basically makes a selection.

This works great, the selection is made and the marching ants are shown.

I have also created a BatchPlay to Hide the Marching Ants shown below

    function HideAnts() {

   const batchPlay = require("photoshop").action.batchPlay;
   const result = batchPlay(
            _obj: "select",
            _target: [
                  _ref: "$Mn",
                  _enum: "$MnIt",
                  _value: "toggleShowExtras",
      ], {
      "synchronousExecution": false,
      "modalBehavior": "fail"

I want the Marching Ants to be hidden after the selection has been made.

I have tried calling the HideAnts() function after the BatchPlay has made the selection but the Ants never seem to hide


That’s literally the first time I’ve heard the expression “Marching Ants”, didn’t know that this was the term for it :sweat_smile:
What does you full code sequence look like? The function you posted is async, maybe there are some race conditions that mess up the order in which the calls finish?

For the moment, I am hiding them using the Select - Deselect Option which has go me past a hurdle.

I may revisit this further down the line.