# Scripting: Loop through content of effect chain

**URL:** <https://qa.fmod.com/t/scripting-loop-through-content-of-effect-chain/22737>\
**Category:** FMOD Studio\
**Tags:** studio-scripting-api\
**Created:** [March 27, 2025, 10:36am UTC](https://qa.fmod.com/t/scripting-loop-through-content-of-effect-chain/22737 "2025-03-27T10:36:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![deHaan](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/dehaan/32/68_2.png) [@deHaan](https://qa.fmod.com/u/deHaan)\
**Post date:** [March 27, 2025, 10:36am UTC](https://qa.fmod.com/t/scripting-loop-through-content-of-effect-chain/22737/1 "2025-03-27T10:36:37Z")

</div>

Hi,

Is it possible to loop through all the content of effect chains when scripting for FMOD? Haven’t been able to do this yet.

Sorry about all my scripting questions, but your responses are super helpful!

Cheers,  
Nikolaj

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [March 27, 2025, 9:20pm UTC](https://qa.fmod.com/t/scripting-loop-through-content-of-effect-chain/22737/2 "2025-03-27T21:20:03Z")

</div>

No worries!

I have made a script that will log all the effects on the master track on an event:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/8/8ab35d4af70702da3da2ec7a15f9d5f9f743d151.png)

```js
studio.menu.addMenuItem({
    name: "Examples\\Effect Chain",
    execute: function() {
        var event = studio.window.browserCurrent();

        // Make sure we only continue on events
        if (event.entity === "Event") {
            var effects = event.masterTrack.mixerGroup.effectChain.effects;

            // There will always be a fader so look for more than 1 effect
            if (effects.length <= 1) // Fixed incorrect greater than
            {
                alert("Only found 1 effect which may be the fader");
                return;
            }
            effects.forEach(function(effect)
            {
                console.log(effect);
            })
        }
        else
        {
            // Currently not selecting an event in the studio window
            alert("Please select an event");
        }
    }
});

```

Console log:

```txt
(ManagedObject:MixerBusFader)
(ManagedObject:SpatialiserEffect)
(ManagedObject:SFXReverbEffect)

```

Let me know if this is the behavior you are after. If not, what content are we looking for?

_Edit correcting code_

---

<div class="post-metadata">

**Author:** ![deHaan](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/dehaan/32/68_2.png) [@deHaan](https://qa.fmod.com/u/deHaan)\
**Post date:** [March 27, 2025, 10:07pm UTC](https://qa.fmod.com/t/scripting-loop-through-content-of-effect-chain/22737/3 "2025-03-27T22:07:39Z")

</div>

Hi Connor,

Thank you. I was specifically looking for a way to loop through the effects inside an “effect chain”, like EffectChainA in the image here:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/8/8649e7c9b1a5cba33590cbd1a10141b8b3d99665.jpeg)

The script you shared doesn’t seem to consider effects inside effect chains, so it just says " Only found 1 effect which may be the fader" fort this event

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [March 27, 2025, 10:43pm UTC](https://qa.fmod.com/t/scripting-loop-through-content-of-effect-chain/22737/4 "2025-03-27T22:43:25Z")

</div>

Thanks for the info. Sorry about that I got a `<` the wrong way round…

Here is the updated script to find and log the effects in an effect chain:

```js
studio.menu.addMenuItem({
    name: "Examples\\Effect Chain",
    execute: function() {
        var event = studio.window.browserCurrent();

        // Make sure we only continue on events
        if (event.entity === "Event") {
            var effects = event.masterTrack.mixerGroup.effectChain.effects;
            // There will always be a fader so look for more than 1 effect
            if (effects.length <= 1)
            {
                console.log("Only found 1 effect which may be the fader");
                return;
            }
            var foundEffectChain = false
            effects.forEach(function(effect)
            {
                if (effect.entity == "ProxyEffect")
                {
                    var subChain = effect.preset.effect.effects;
                    if (subChain != null)
                    {
                        console.log("Found an effect chain");
                        foundEffectChain = true;
                        subChain.forEach(function(subEffect)
                        {
                            console.log(subEffect);
                        })
                        console.log("End of the effect chain");
                    }
                }
            })

            if (!foundEffectChain)
                console.log("Could not find an effect chain");
        }
        else
        {
            // Currently not selecting an event in the studio window
            console.log("Please select an event");
        }
    }
});

```

---

<div class="post-metadata">

**Author:** ![deHaan](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/dehaan/32/68_2.png) [@deHaan](https://qa.fmod.com/u/deHaan)\
**Post date:** [March 28, 2025, 9:52am UTC](https://qa.fmod.com/t/scripting-loop-through-content-of-effect-chain/22737/5 "2025-03-28T09:52:09Z")

</div>

Thank you Connor, that was super helpful!
