WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
geekyadam
Posts: 45
Joined: 01 Aug 2016, 17:11

WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

15 Jan 2019, 10:38

In a Cisco Webex Meeting window, ctrl+m toggles your voice mute. I am simply trying to either send ctrl+m to Webex window, or better yet use WinMenuSelectItem to select Participant > Unmute Me option.
Image

From AHK's Active Window Info while Webex window is active:

Code: Select all

Cisco Webex Meetings
ahk_class wcl_manager1
ahk_exe atmgr.exe
This does nothing and ErrorLevel is set to 0:

Code: Select all

!pgup::ControlSend, ,^m, Cisco Webex Meetings ahk_class wcl_manager1 ahk_exe atmgr.exe
This does nothing and ErrorLevel is set to 1:

Code: Select all

!pgup::WinMenuSelectItem, Cisco Webex Meetings ahk_class wcl_manager1 ahk_exe atmgr.exe, , Participant, Unmute Me
I have confirmed using WinActivate does activate the Webex window correctly (so theoretically, I could activate the window, Send ^m, then activate previously active window, but I don't want to do that). I've also tried using just "Cisco Webex Meetings" without ahk_class or ahk_exe for the hotkeys above, same results.

I have confirmed that the hotkey I'm using works fine. I have confirmed similar usage of ControlSend and WinMenuSelectItem works in other apps, just not in my Webex window.
gregster
Posts: 8921
Joined: 30 Sep 2013, 06:48

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

15 Jan 2019, 16:39

Run script as admin?
(But afaik, ControlSend won't work with some applications)
User avatar
geekyadam
Posts: 45
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

15 Jan 2019, 17:29

gregster wrote:
15 Jan 2019, 16:39
Run script as admin?
(But afaik, ControlSend won't work with some applications)
Oh are there known caveats with ControlSend just not working with some programs? I didn't know about that...
Does anyone have any ideas on alternate routes I could accomplish this? (besides WinActivate, Send, WinActivate back)
hunter99
Posts: 129
Joined: 20 Jan 2014, 17:57

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

15 Jan 2019, 19:08

Hi geekyadam, this might help.

Don't have Cisco Webex Meeting, so used notepad to test format.
Uncomment the key to try.

Code: Select all

;!pgup::WinMenuSelectItem, Untitled - Notepad, , File, Open       ;may work when one below will not
;!pgup::WinMenuSelectItem, Untitled - Notepad, , 1&, 2&            ;may work when one above will not
                                                                                                  ;most times both will work
;!pgup::WinMenuSelectItem, Untitled - Notepad, , 2&, 14&          ;Time/Date (must count separator lines)
;!pgup::Controlsend, , ^a, Untitled - Notepad                              ;ahk_class Notepad
;!pgup::Controlsend, , {f5}, ahk_class Notepad
Use just one of these:
Cisco Webex Meetings
ahk_class wcl_manager1
ahk_exe atmgr.exe

See docs for WinMenuSelectItem, it states it will NOT work if not a true MS menu.
Uncomment the key to try.

Code: Select all

;!pgup::WinMenuSelectItem, Cisco Webex Meetings, , Participant, Unmute Me

;!pgup::WinMenuSelectItem, Cisco Webex Meetings, , 6&, 2&

;!pgup::ControlSend, ,^m, ahk_class wcl_manager1
Get a copy of CodeQuicktester by GeekDude from here:
https://autohotkey.com/boards/viewtopic.php?f=6&t=6113
better yet use WinMenuSelectItem to select Participant > Unmute Me option
Why?

hunter99
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

15 Jan 2019, 20:53

run script as admin, and try..

Code: Select all

F12::ControlSend, ahk_parent ,^m, Cisco Webex Meetings
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

15 Jan 2019, 23:01

Below is the code often used for running the script as admin, which is placed near the top, but below commands like #Include, #Persistent, #SingleInstance, etc... that are put in the auto-execute section at the top of the script. Many newbies might see "run as admin" comments, but might not know exactly what that is.

Code: Select all

If not A_IsAdmin 
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}
This looks like a case where you might experiment with the newer command, "ControlSendRaw". Unfortunately, not using Cisco Webex Meetings, so these are suggestions versus actually playing with the same software. Another command to try would be "PostMessage".

Lastly, don't know why you are against using the "Send" commands, if "ControlSend" doesn't work. Do you have any particular reason for this?
User avatar
geekyadam
Posts: 45
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 10:36

hunter99 wrote:
15 Jan 2019, 19:08
Hi geekyadam, this might help.

Don't have Cisco Webex Meeting, so used notepad to test format.
Uncomment the key to try.

Code: Select all

;!pgup::WinMenuSelectItem, Untitled - Notepad, , File, Open       ;may work when one below will not
;!pgup::WinMenuSelectItem, Untitled - Notepad, , 1&, 2&            ;may work when one above will not
                                                                                                  ;most times both will work
;!pgup::WinMenuSelectItem, Untitled - Notepad, , 2&, 14&          ;Time/Date (must count separator lines)
;!pgup::Controlsend, , ^a, Untitled - Notepad                              ;ahk_class Notepad
;!pgup::Controlsend, , {f5}, ahk_class Notepad
I tried this during my debugging as well, and it works perfectly. The Notepad "open file..." window pops up even when Notepad is not focused.
hunter99 wrote:
15 Jan 2019, 19:08
Use just one of these:
Cisco Webex Meetings
ahk_class wcl_manager1
ahk_exe atmgr.exe
I have tried using just "Cisco Webex Meetings" but still same behavior.
hunter99 wrote:
15 Jan 2019, 19:08
See docs for WinMenuSelectItem, it states it will NOT work if not a true MS menu.
Yeah I'm wondering if that is the case with this particular program... :( Is there any way to test to confirm if it is not a true MS menu?
Uncomment the key to try.
hunter99 wrote:
15 Jan 2019, 19:08
Get a copy of CodeQuicktester by GeekDude from here:
https://autohotkey.com/boards/viewtopic.php?f=6&t=6113
I'm unfamiliar with this, how would this help my situation?
hunter99 wrote:
15 Jan 2019, 19:08
better yet use WinMenuSelectItem to select Participant > Unmute Me option
Why?
With Cisco Webex Meetings, ctrl+m toggles the muting of your audio, so one hotkey would toggle back and forth and I would need to keep eyes on the program to confirm if I am currently muted or not. However there are menu options specifically to mute and unmute individually (see screenshot), which means I could dedicate one hotkey for muting and another just for unmuting. That way when I press the muting hotkey a couple times, I can be more sure that I am muted. Only pressing the dedicated unmute hotkey will unmute me. I would be satisfied to get either method working successfully, but would prefer the menu options if possible for that reason.
User avatar
geekyadam
Posts: 45
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 10:37

tmplinshi wrote:
15 Jan 2019, 20:53
run script as admin, and try..

Code: Select all

F12::ControlSend, ahk_parent ,^m, Cisco Webex Meetings
Hmm, I've been using AHK consistently for 10+ years I think, but I don't think I've ever used the ahk_parent option...I'll have to learn more about that...
While I learn more about it, can you offer info on how you think that could positively impact my issue? Thanks.
User avatar
geekyadam
Posts: 45
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 10:55

tmplinshi wrote:
15 Jan 2019, 20:53
run script as admin, and try..

Code: Select all

F12::ControlSend, ahk_parent ,^m, Cisco Webex Meetings
SOTE wrote:
15 Jan 2019, 23:01
Below is the code often used for running the script as admin, which is placed near the top, but below commands like #Include, #Persistent, #SingleInstance, etc... that are put in the auto-execute section at the top of the script. Many newbies might see "run as admin" comments, but might not know exactly what that is.

Code: Select all

If not A_IsAdmin 
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}
I will try running the script as admin as a test to try to get to the bottom of the reason why this isn't working normally. Will report back here once I do.
SOTE wrote:
15 Jan 2019, 23:01
This looks like a case where you might experiment with the newer command, "ControlSendRaw". Unfortunately, not using Cisco Webex Meetings, so these are suggestions versus actually playing with the same software.
I thought ControlSendRaw just allows to send literal keys when something normally looks like an AHK identifier such as "{ENTER}" would literally send those characters rather than the Enter button. Does ControlSendRaw do something else differently than ControlSend besides just that? i.e. does it send the characters differently such as Send vs SendPlay vs SendInput etc?
SOTE wrote:
15 Jan 2019, 23:01
Another command to try would be "PostMessage".
Yeah I haven't used PostMessage much at all, but I thought that might be a potential path forward. I would love someone with experience with PostMessage to chime in with some examples of what my path forward with that might look like.
SOTE wrote:
15 Jan 2019, 23:01
Lastly, don't know why you are against using the "Send" commands, if "ControlSend" doesn't work. Do you have any particular reason for this?
My usage of AHK is most heavily involved on my work system, and I have many windows open. Sometimes when using WinActivate multiple times within a short amount of time does not always work as fast as I would hope. For that reason, going that route with this scenario may actually take a few seconds to switch to the Webex window, mute, then switch back, all of which I would lose focus of my current window for. So I would be forced to pause what I'm doing for a few seconds every time I use the hotkey. In addition, the potential latency of switching windows would mean I am not immediately muted/unmuted, which I want to be as fast as possible after pressing the hotkey. Also, there are times when my AHK code activates a window, and just by coincidence, another window pops up and takes focus so sent keys go to the wrong window and never correctly send to the intended window. It doesn't happen all the time, but it happens from time to time. I'd like to avoid that if at all possible.
User avatar
geekyadam
Posts: 45
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 11:20

I've just tried running the script as admin (confirming that A_IsAdmin value is 1), and no improvement. I tried both ControlSend as well as WinMenuSelectItem and neither work.

From the helpful info you guys left above, it looks like my only potential route forward may be PostMessage or juggling window focus (WinActivate Webex, WinWait, Send ^m, WinActivate previous window, WinWait). For the PostMessage route, I'm not familiar enough with that to know where to begin, I would appreciate help if anyone can offer it.
User avatar
geekyadam
Posts: 45
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 11:30

tmplinshi wrote:
15 Jan 2019, 20:53
run script as admin, and try..

Code: Select all

F12::ControlSend, ahk_parent ,^m, Cisco Webex Meetings
Just tried this but still not working.
hunter99
Posts: 129
Joined: 20 Jan 2014, 17:57

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 15:39

Yeah I'm wondering if that is the case with this particular program... :( Is there any way to test to confirm if it is not a true MS menu?
Use this to confirm, you can get it here. Read all the posts there.
“Alt Menu Search.ahk” by lexikos. From here - http://ahkscript.org/boards/viewtopic.php?f=6&t=8085

If you find it's not a true menu, you could try creating keyboard macros and using SendInput.
Window must be active to work, so this may be of no use to you. But you could write a small ahk file to activate the window and unmute and run using the Run command.
Shortcut keys: fastest – not always easily found.
Access keys or Keytips: slower, may flash menu or dialog box – easily found by hitting Alt key, showing underlined letters or charters in square box.

Example is for windows Paint, it change brush color. Using ctrl + j for key.

^j::SendInput !h1!hec!r55!g255!u0{enter}

!h1 picks the foreground color. !hec opens the color dialog box. !r55 sets the Red value. !g255 sets the Green value. !u0 sets the Blue value. Finally we use {Enter} to effect the change and close the color window.
I used Alt with the underlined letters r, g, and u.
Could used Tabs like this !h1!hec{Tab 7}55{Tab}255{Tab}0{enter} but not as readable.
I'm unfamiliar with this, how would this help my situation?
It’s a small app to run and test small snippets of code rather than use a full blown editor. I find it makes for much faster testing. As you can make changes to the code and just hit the run bar. Just paste the example for windows Paint shown above, to try it.

I think you will come up with something that will make you happy.
hunter99
hunter99
Posts: 129
Joined: 20 Jan 2014, 17:57

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 17:29

Hi geekyadam,
This might give you some ideas.

Code: Select all

;Example to show changing from the active window to MSPaint, make changes there and go back to original window 
~!w::						;change key to suit
WinGetActiveTitle, oTitle		;oTitle is the variable containing title of active window when key is hit
WinActivate, ahk_class MSPaintApp		;MSPaint is made active
;comment out just one of the next 2 lines
;SendInput !h1!hec!r55!g255!u0{enter}		;code shown in my last post. Changes paint color to green
SendInput !h1!hec{Tab 7}55{Tab}255{Tab}0{enter}		;as above but uses tabs
WinActivate, %oTitle%			;makes original window active
Return
good luck, hunter99
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 20:14

There's also this for discovering menu item IDs for context menus (for use with PostMessage/SendMessage). You may need to run it in admin mode for it to work on your program.
Get Info from Context Menu (x64/x32 compatible) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=31971
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
hunter99
Posts: 129
Joined: 20 Jan 2014, 17:57

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

17 Jan 2019, 21:19

Seeing jeeswg's post above I should mentioned that in 3rd post above I posted the link for "Alt Menu Search.ahk” by lexikos:
Should have also mentioned that the PostMessage ID is displayed at bottom right of the Gui.
But thanks for this one, which I think will see more use.
Really like jeeswg's link as all IDs and menu names are shown at once and if not a true menu, the menu names will be shown as (empty string).
hunter99
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

18 Jan 2019, 01:20

geekyadam wrote:
17 Jan 2019, 10:55
SOTE wrote:
15 Jan 2019, 23:01
Lastly, don't know why you are against using the "Send" commands, if "ControlSend" doesn't work. Do you have any particular reason for this?
My usage of AHK is most heavily involved on my work system, and I have many windows open. Sometimes when using WinActivate multiple times within a short amount of time does not always work as fast as I would hope. For that reason, going that route with this scenario may actually take a few seconds to switch to the Webex window, mute, then switch back, all of which I would lose focus of my current window for. So I would be forced to pause what I'm doing for a few seconds every time I use the hotkey. In addition, the potential latency of switching windows would mean I am not immediately muted/unmuted, which I want to be as fast as possible after pressing the hotkey. Also, there are times when my AHK code activates a window, and just by coincidence, another window pops up and takes focus so sent keys go to the wrong window and never correctly send to the intended window. It doesn't happen all the time, but it happens from time to time. I'd like to avoid that if at all possible.
I came up with an alternative solution for non-standard Windows some years ago at work. Don't know where I put the script at, but I can give the concept of the idea.

Correction- I would use the ahk_id(WinGetTitle, title, ahk_id %id%) to identify if the mouse was on the menu or submenu. Then I made a mathematical representational grid of the height and width of each row, aided by information given from various sub-commands in Sysget. With non-standard Windows, the height and width for each row in a menu can differ, so the correct calculation has to be specific to that program and it's ahk_class(WinGetClass, class, ahk_id %id%). When the row was highlighted (whenever your mouse was on it or you used the keyboard), I would know it's position on the grid. I would record it to a variable, that you can then write to a .ini or .txt file. You could then read the .ini file or manually put the position of the row manually in your script.

Hopefully I can find the script, but if not, I might try to recreate it. But don't hold your breath, as I'm involved in various other things. I present the idea, as maybe some other guys can make a variation of it. To be honest, AutoHotkey does need an alternative solution for the WinMenuSelectItem problem of dealing with non-standard Windows. After all, AutoHotkey does automation and that should be it's strength.
Last edited by SOTE on 19 Jan 2019, 02:48, edited 5 times in total.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

18 Jan 2019, 01:47

- These messages can be used to invoke an item in a visible (standard) context menu.
context menu window messages: focus/invoke item - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=39209
- Acc can be useful also for getting menu item strings/invoking menu items.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

19 Jan 2019, 02:49

Script that will give you some info about both standard and non-standard windows menus and submenus.
Note 1- You can get the ahk_id info pertaining to the menu and submenu with this. PixelGetColor will also tell you if the row is highlighted or not.
Note 2- Can't find my original completed script from years ago, but used this as the basis to start building the script for non-standard Windows menus and submenus. The first step was getting info about the target menu.
Note 3- Script will go bonkers sometimes when on a Edit1 control, so don't be surprised. Just pause, escape, or close and try to avoid the problem area.

Edited...

With the additional ahk_id, ahk_class, path of active window, and height and width of the corresponding submenu "windows" that open, you could probably risk making a script using just Send (remember there are shortcut keys too) or MouseClicks (though that would be a little less reliable), as oppose to ControlSend, because you can be more assured that it's going to the correct program and menu location. However, I don't blame anyone for trying to make their script as airtight and specific as possible.

Using the below script, you can get the ahk_id and ahk_class info to do something with variables like If (ID = X) AND (Class = Y) AND (Title = Z) when you press or send the ALT key (works with most programs) to activate the top menu. The variables X, Y, and Z being the information provided by the below script... Then If (ID = X) AND (Class = Y) AND (MenuWidth = Z1) AND (MenuHeight = Z2) for when the arrow key is pressed or short cut key is activated for the submenu (it's #32768 in standard Windows, but other things in non-standard Windows), it's extremely likely you are in the correct Window and menu. To top it all off, the below script shows the file path for the active window, which could be put into a variable too. This is a more simplistic method, but very likely to be highly reliable, due to all the variables needing to be correct before proceeding to the next steps and it will work on standard or non-standard Windows and menus.

Code: Select all

#Persistent
SetTimer, CursorWatch, 200
return

^p::pause
esc::ExitApp

CursorWatch:
MouseGetPos, OutputVarX, OutputVarY, id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
WinGetPos, WinX, WinY, MenuWidth, MenuHeight, ahk_id %id%
WinGet, ActivePath, ProcessPath, A
ControlGetText, ControlText, %control%, A
ControlGet, ControlHwnd, Hwnd,, %control%, A
PixelGetColor, color, %OutputVarX%, %OutputVarY%
If not WinActive("Notepad") AND (control != "Edit1")
ToolTip, ahk_id %id%`nahk_class %class%`nWindow Title: %title%`nActive Path: %ActivePath%`nControl: %control%`nControlText: %ControlText%`nMousePos: %OutputVarX%x%OutputVarY%`nColor: %color%`nCursor Info:  %A_Cursor%`nMenu Width : %MenuWidth% Menu Height : %MenuHeight%`n
return
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

20 Jan 2019, 02:11

I have been playing around with non-standard menus a little bit, to see how reliably you can identify them and then make a script for them by using the code above. Especially since a lot more programs are non-standard on Windows these days, due to the influence of tools from the Linux world or different programming languages. You could tweak WindowSpy.ahk, but the above script is more simplistic and arguably easier to tweak for a specific purpose.

When we use WinMenuSelectItem or ControlSend, let's consider what's in them.

ControlSend [, Control, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText]
WinMenuSelectItem, WinTitle, WinText, Menu [, SubMenu1, SubMenu2, SubMenu3, SubMenu4, SubMenu5, SubMenu6, ExcludeTitle, ExcludeText]

For the most part, you are putting in the window title and then the control info or having the menu to act upon identified for you. When encountering a non-standard Windows menu, we can get class name or ahk_id with our limited Window info script or by putting the commands into the automating script itself to get this information, before doing some action.

I decided to pick on Open Office, because it uses a non-standard GUI and menu. WinGet will give us the ID info, so that we can figure out the class name. With Open Office it's SALFRAME, and if you open up submenus, it will change to SALTMPSUBFRAME. You can also use the info from ahk_id or the ID variable as well to more clearly identify windows, menus, and submenus. For instance you will get #32768 for the class name with the submenu of standard windows.

The combination of class and title allows us to be quite confident we are acting upon the correct Window. We can use AND (to include OR or NOT) to keep adding conditions and variables that must be correct, before using SEND. This simplistic method will be just about as reliable as ControlSend or WinMenuSelectItem and make it pretty easy to whip up a script for automating non-standard menus. Note- Shortcut keys or using the keyboard will tend to be more reliable than MouseClicks, but maybe not by much. When using class names and adding other variables (like height and width of the menu and submenu window), MouseClicks are quite accurate too.

This simple solution can have a hotkey above to active it or it can be under a label in your script and called by Gosub (Gosub, Label).

Code: Select all

WinGet, ID, ID, A
WinGetTitle, title, ahk_id %ID%
WinGetClass, class, ahk_id %ID%

If WinActive("ahk_class" . "SALFRAME") AND InStr(title,"OpenOffice Calc")
{
Send, ^p ; opens print window
WinWait, Print ; title of print window
WinActivate, Print
Send, !{f4}
}
Or open properties with just keyboard input

Code: Select all

WinGet, ID, ID, A
WinGetTitle, title, ahk_id %ID%
WinGetClass, class, ahk_id %ID%

If WinActive("ahk_class" . "SALFRAME") AND InStr(title,"OpenOffice Calc")
{
Send, {RALT} ; the ALT tends to activate most menus
Send, {Down 14}
Send, {Enter} ; opens the Properties window or use the Send, !{i}
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww and 144 guests