I have composed a .vbs file with near zero knowledge of this coding language (with major code from here and here). I put this together to get my computer to tell me the time every 15 minutes (combined with task scheduler). The trickiest part was to have the script check if zoom was running (as to not interrupt video calls with the speech voice). Now, I would like to take it a step further and check for a second process, Microsoft Teams, for the same reason (to not interrupt video calls). So, I have my basic script copied below. It works for telling time and checking for zoom, but I am unsure how to go about adding "Microsoft Teams" to be checked also.
Dim hour_now, minute_now, speaks, speech
hour_now = hour(time)
minute_now = minute(time)
If minute_now = 0 Then
speaks = "Il est " & hour_now & " heures"
Else
speaks = "Il est " & hour_now & " heures " & minute_now & " minutes"
End If
Set speech = CreateObject("sapi.spvoice")
Dim i
Dim strComputer
Dim FindProc
strComputer = "."
FindProc = "zoom"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select Name from Win32_Process WHERE Name LIKE '" & FindProc & "%'")
If colProcessList.count>0 then
'wscript.echo FindProc & " is running"
else
'wscript.echo FindProc & " is not running"
speech.Speak speaks
End if
Set objWMIService = Nothing
Set colProcessList = Nothing
I imagine that I'd need to either set the FindProc
object to a list of two and either iterate or have it evaluate all at once. Any help is appreciated. BTW, my computer has a French voice so the telling time is written for French.
Also, if anyone has any ideas as how to set this task up with some kind of off/on button or switch, that could be useful, too.
TIA