# Add only actions from the respective set to the list

**URL:** <https://forums.creativeclouddeveloper.com/t/add-only-actions-from-the-respective-set-to-the-list/5813>\
**Category:** Photoshop\
**Created:** [February 8, 2023, 1:47pm UTC](https://forums.creativeclouddeveloper.com/t/add-only-actions-from-the-respective-set-to-the-list/5813 "2023-02-08T13:47:17Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![PS-fxrios](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ps-fxrios/32/2461_2.png) [@PS-fxrios](https://forums.creativeclouddeveloper.com/u/PS-fxrios)\
**Post date:** [February 15, 2023, 3:14am UTC](https://forums.creativeclouddeveloper.com/t/add-only-actions-from-the-respective-set-to-the-list/5813/7 "2023-02-15T03:14:12Z")

</div>

Hi @Jarda, man I tried to follow the links you indicated, but it left my head with bugs, I’m not at that level of understanding such complex code. I tried something with the codes at the end of this [link](http://forums.creativeclouddeveloper.com/t/any-efficient-way-to-get-all-actions-list/4013) however, I was not successful.  
I ended up finding the solution in this other post:[Execute a script via a button - #8 by ddbell](http://forums.creativeclouddeveloper.com/t/execute-a-script-via-a-button/3699/8)  
The result was quite satisfactory:

```auto
const getActionSet = require('photoshop').app.actionTree;
const ActionSet = document.getElementById("list_AS")
const AcrionList = document.getElementById("list_AC")

for (let i=0; i<getActionSet.length; i++){
     ActionSet.insertAdjacentHTML("beforeend", `<sp-menu-item>${getActionSet[i].name}</sp-menu-item>`); 
}

ActionSet.addEventListener("change", evt => {
    AcrionList.innerHTML ="";
    for (let i=0; i<getActionSet.length; i++){ var getActionItens = getActionSet[evt.target.selectedIndex]}
    for (let i=0; i<getActionItens.actions.length; i++){
         AcrionList.insertAdjacentHTML("beforeend", `<sp-menu-item>${getActionItens.actions[i].name}</sp-menu-item>`); 
         AcrionList.selectedIndex = 0;
    }
})

document.querySelector("#btnRun").addEventListener("click", evt => {
    core.executeAsModal( async() => {
      const list_AS = ActionSet.value; list_AC = AcrionList.value;
      await app.batchPlay([{"_obj":"play","_target":[{"_name": list_AC,"_ref":"action"},{"_name": list_AS,"_ref":"actionSet"}]}], { });
    })
})

```

Here I share the 100% working plugin, maybe someone might find this useful.  
[ACTIONS-LIST\_PS.ccx](https://forums.creativeclouddeveloper.com/uploads/short-url/4HO7kBoujgcGCoq9riefcSC9Pce.ccx) (6.7 KB)

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/add-only-actions-from-the-respective-set-to-the-list/5813)._
