Microsoft Teams not receiving commands

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kriollo
Posts: 4
Joined: 21 Feb 2022, 19:57

Microsoft Teams not receiving commands

Post by Kriollo » 21 Feb 2022, 20:27

Hi everyone.

Since last week I've noticed that Microsoft Teams is not responding to my AHK scripts; even a simple command like MouseMove is not working when the main window of Microsoft Teams is active; simply said, is like MSTeams somehow blocks commands when they are coming from AHK. Have had you people the same issue? As an example here's one of the scripts that a week ago used to work fine and today is failing.

Code: Select all

SetKeyDelay, 200,100
Send {LWin}Microsoft Teams
Send {Enter}
WinActivate, ahk_exe Teams.exe
WinWaitActive, ahk_exe Teams.exe
Sleep 3000
#IfWinActive ahk_exe Teams.exe
Send ^e/available{Enter} ;This part used to work fine, now does nothing
Return
Thanks in advance for your replies.

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Microsoft Teams not receiving commands

Post by mikeyww » 21 Feb 2022, 20:55

I had no trouble with a test script.

Code: Select all

F3::
WinActivate, ahk_exe Teams.exe
Send abc
Return
The following also worked.

Code: Select all

#IfWinExist ahk_exe Teams.exe
F3::
WinActivate
Send ^e/available
Sleep, 100
Send `n
Return
#IfWinExist
See documentation about how to use directives for context-sensitive hotkeys. These directives do not work with "running code".

https://www.autohotkey.com/docs/commands/_IfWinActive.htm

You can always try running your script as admin.

#If is not If.

User avatar
boiler
Posts: 17404
Joined: 21 Dec 2014, 02:44

Re: Microsoft Teams not receiving commands

Post by boiler » 21 Feb 2022, 23:01

As another data point, I have an AHK script that runs while Teams is running without a problem.

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Microsoft Teams not receiving commands

Post by mikeyww » 21 Feb 2022, 23:24

Antivirus software can also sometimes play a role in blocking scripts.

User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Microsoft Teams not receiving commands

Post by Xtra » 22 Feb 2022, 03:28

Just tried this and it works for me:

Code: Select all

SetKeyDelay, 200, 100
ControlFocus, Chrome_RenderWidgetHostHWND1, ahk_exe Teams.exe
ControlSend, Chrome_RenderWidgetHostHWND1, ^e/available{Enter}, ahk_exe Teams.exe

Kriollo
Posts: 4
Joined: 21 Feb 2022, 19:57

Re: Microsoft Teams not receiving commands

Post by Kriollo » 22 Feb 2022, 06:57

Thank you all for your replies.

I tried all your suggestions, but still no solution. I also have noticed that the issue is not only with AHK, but with all third party apps that send commands (I also tried with TinyTask and another program for screenshots), the issue is the same: as soon as the Microsoft Teams window becomes active, all commands are blocked and work no more.

My current version of Microsoft Teams is 1.5.00.4689 and for AHK is 1.1.33.08.

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Microsoft Teams not receiving commands

Post by mikeyww » 22 Feb 2022, 07:04

1. Which antivirus software did you disable?

2. Which technique did you use to run the script as admin?

3. When you run this script (below, with no other code), activate Teams, see the green AHK icon in the system tray, and press F3, what happens?

Code: Select all

F3::MsgBox, 64, Test, Test

Kriollo
Posts: 4
Joined: 21 Feb 2022, 19:57

Re: Microsoft Teams not receiving commands

Post by Kriollo » 22 Feb 2022, 13:38

mikeyww wrote:
22 Feb 2022, 07:04
1. Which antivirus software did you disable?

2. Which technique did you use to run the script as admin?

3. When you run this script (below, with no other code), activate Teams, see the green AHK icon in the system tray, and press F3, what happens?

Code: Select all

F3::MsgBox, 64, Test, Test
1. Windows security Antivirus (The one included by default on Win10)

2. I use CMD running as Admin

Code: Select all

START "Window01" /D "C:\Users\user\AutoHotkey_1.1.33.08" /B AutoHotkeyU64.exe "C:\Users\user\AHK_Scripts\Test02.ahk"

3.1. When I run the script without Teams window active
image.png
image.png (2.15 KiB) Viewed 1545 times
Also, the log registers the action correctly

Code: Select all

Script lines most recently executed (oldest first).  Press [F5] to refresh.  The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0).  The bottommost line's elapsed time is the number of seconds since it executed.

---- C:\Users\user\AHK_Scripts\Test02.ahk
001: Return (11.45)
001: MsgBox,64,Test,Test (1.19)
001: Return (3.92)
001: MsgBox,64,Test,Test (1.14)
001: Return (1.28)

Press [F5] to refresh.
3.2. When I run the script with Teams window active, nothing happens, the green icon on system tray doesn't change, but also no MsgBox is executed and no log is recorded.

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Microsoft Teams not receiving commands

Post by mikeyww » 22 Feb 2022, 13:55

Huh. :wtf: Thank you for providing the answers! I cannot explain the findings. :? Others here may know. Await the experts!

gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: Microsoft Teams not receiving commands

Post by gregster » 22 Feb 2022, 14:16

No expert here - but still looks like a privileges issue to me.
I am not sure about your command line approach. Didn't you try the simple right-click on the ahk-file > Run as admin, or https://www.autohotkey.com/docs/commands/Run.htm#RunAs ?

Kriollo
Posts: 4
Joined: 21 Feb 2022, 19:57

Re: Microsoft Teams not receiving commands

Post by Kriollo » 23 Feb 2022, 06:39

gregster wrote:
22 Feb 2022, 14:16
No expert here - but still looks like a privileges issue to me.
I am not sure about your command line approach. Didn't you try the simple right-click on the ahk-file > Run as admin, or https://www.autohotkey.com/docs/commands/Run.htm#RunAs ?
Gregster:

Yes , I already tried that solution, same result (ahk file -> right-click -> Run as admin). Also I tried to compile the file, and execute the EXE file as an administrator, and still doesn't work.

nairnmonster3981
Posts: 10
Joined: 27 Jun 2021, 07:10

Re: Microsoft Teams not receiving commands

Post by nairnmonster3981 » 25 Apr 2023, 14:37

Kriollo wrote:
23 Feb 2022, 06:39
gregster wrote:
22 Feb 2022, 14:16
No expert here - but still looks like a privileges issue to me.
I am not sure about your command line approach. Didn't you try the simple right-click on the ahk-file > Run as admin, or https://www.autohotkey.com/docs/commands/Run.htm#RunAs ?
Gregster:

Yes , I already tried that solution, same result (ahk file -> right-click -> Run as admin). Also I tried to compile the file, and execute the EXE file as an administrator, and still doesn't work.
Hi, did you ever get a fix for this?
Mine has just started doing it out of the blue today and also RDP sessions are the exact same. Even some other apps, Keepass. If the AHK clicks that it stops the proccess.
No idea how to fix this, driving me nuts!!!

Post Reply

Return to “Ask for Help (v1)”