# Setting minimum brush opacity

**URL:** <https://forums.creativeclouddeveloper.com/t/setting-minimum-brush-opacity/3104>\
**Category:** UXP Plugin API\
**Created:** [June 16, 2021, 5:11pm UTC](https://forums.creativeclouddeveloper.com/t/setting-minimum-brush-opacity/3104 "2021-06-16T17:11:24Z")\
**Posts on this page:** 1\
**Showing post:** 35

<div class="post-metadata">

**Author:** ![assitburn](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/assitburn/32/1499_2.png) [@assitburn](https://forums.creativeclouddeveloper.com/u/assitburn)\
**Post date:** [June 17, 2022, 8:40am UTC](https://forums.creativeclouddeveloper.com/t/setting-minimum-brush-opacity/3104/35 "2022-06-17T08:40:20Z")

</div>

Here the complete code:

```auto
const batchPlay = require("photoshop").action.batchPlay;
// GET TOOL OPTIONS
async function getCurrentToolOptions () {
  const app = require('photoshop').app;
  const result = await batchPlay(
  [
     {
        "_obj": "get",
        "_target": [
           {
              "_property": "currentToolOptions"
           },
           {
              "_ref": "application",
              "_enum": "ordinal",
              "_value": "targetEnum"
           }
        ],
        "_options": {
           "dialogOptions": "dontDisplay"
        }
     }
  ],{
     "synchronousExecution": false
  });
  return result[0].currentToolOptions;
}

// SET TOOL OPTIONS
async function setCurrentToolOptions(currenttooloptions) {
  const app = require('photoshop').app;
  const result = await batchPlay(
  [
     {
        "_obj": "set",
        "_target": [
           {
             "_ref": "paintbrushTool"
           }
        ],
        "to": currenttooloptions
     }
  ],{
     "synchronousExecution": false
  });
}

async function currentlayer() {
  let cto = await getCurrentToolOptions();
  cto.$StmS = true;
  cto.$StmB = flase;
  await setCurrentToolOptions(cto);
}
await require("photoshop").core.executeAsModal(currentlayer);

```

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/setting-minimum-brush-opacity/3104)._
