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
(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 ?

