I'm trying to write a fairly simple script for Hammerspoon where I am looping through a table of app windows. The problem is for some reason when I call hs.eventtap
inside the loop it keeps firing.
Any help much appreciated
function toggleMute()
local teams = hs.application.find("com.microsoft.teams"):allWindows()
if not (teams == null) then
for i, v in pairs(teams) do
hs.eventtap.keyStroke({"cmd", "shift"}, "m", 0, v)
end
end
hs.alert.show('Mute Toggled')
end