# Advanced Condition, Toggle Mute when browser is on Teams meeting.

**URL:** <https://community.folivora.ai/t/advanced-condition-toggle-mute-when-browser-is-on-teams-meeting/47974>\
**Category:** Configuration Help & General Discussion\
**Created:** [October 7, 2026, 8:29am UTC](https://community.folivora.ai/t/advanced-condition-toggle-mute-when-browser-is-on-teams-meeting/47974 "2026-10-07T08:29:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ageorgios](https://community.folivora.ai/user_avatar/community.folivora.ai/ageorgios/32/5272_2.png) [@ageorgios](https://community.folivora.ai/u/ageorgios)\
**Post date:** [October 7, 2026, 8:29am UTC](https://community.folivora.ai/t/advanced-condition-toggle-mute-when-browser-is-on-teams-meeting/47974/1 "2026-10-07T08:29:58Z")

</div>

![image](https://community.folivora.ai/uploads/default/original/3X/f/9/f99379abecb87721e16fd77cd4c85ba9fb867933.jpeg)

 ![image](https://community.folivora.ai/uploads/default/original/3X/6/9/69eafa2904f105e170a11f63c7768d2683bb0115.png)

What is the best way to import an advanced condition that is:

"While in teems meeting"  
Like checking if mute button exists.

ChatGPT says to create a dynamic variable

```auto
(async () => {
    let value = "0";

    try {
        const result = await runAppleScript(`
            if application "Google Chrome" is not running then return "0"

            tell application "Google Chrome"
                if (count of windows) = 0 then return "0"

                return execute active tab of front window javascript "
                    (() => {
                        if (location.hostname !== 'teams.cloud.microsoft.mcas.ms')
                            return '0';

                        const b = document.getElementById('microphone-button');
                        return b && !b.disabled && b.getClientRects().length > 0
                            ? '1' : '0';
                    })()
                "
            end tell
        `);

        value = String(result).trim() === "1" ? "1" : "0";
    } catch (_) {
        value = "0";
    }

    returnVariableValue(value);
})();

```

is this a good way ?

---

<div class="post-metadata">

**Author:** ![Oleg\_Chernyshev](https://community.folivora.ai/user_avatar/community.folivora.ai/oleg_chernyshev/32/47241_2.png) [@Oleg\_Chernyshev](https://community.folivora.ai/u/Oleg_Chernyshev)\
**Post date:** [November 7, 2026, 3:40pm UTC](https://community.folivora.ai/t/advanced-condition-toggle-mute-when-browser-is-on-teams-meeting/47974/2 "2026-11-07T15:40:05Z")

</div>

Your approach should work, but you have to turn on Chrome's View \> Developer \> "Allow JavaScript from Apple Events". Also, that hostname check only matches the MCAS proxy URL, so plain [teams.microsoft.com](http://teams.microsoft.com) won't trigger it. Honestly it might be simpler to skip the "in meeting" check: a system-wide mic mute works in any app or tab, so it doesn't matter where Teams is running. I made a free open-source menu bar app that does exactly that (one hotkey + on-screen indicator): [lockmic.com](https://lockmic.com/). Disclosure: I'm the dev.
