I loop my script to close Net Send messages as they appear. I want to receive the message (so Net Stop Messenger wouldn't work), I just don't want to see the messages. Is there a more reliable way to close the messages other than using AppActivate with SendKeys? To my understanding, if any window contained "Messenger Service", then check would be true and "{enter}" would be sent into that window.
Code:
Set objWshShell = Wscript.CreateObject("Wscript.Shell")
While 1 = 1
check = objWshShell.AppActivate("Messenger Service")
If check = true then objWshShell.SendKeys "{enter}"
Wscript.Sleep(100)
Wend