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

Get help with using AutoHotkey and its commands and hotkeys
User avatar
geekyadam
Posts: 31
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

24 Jan 2019, 11:34

hunter99 wrote:
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
Thanks much for that info. I did find that Alt Menu Search script very cool. I found the command used to declare if window has a "true menu":

Code: Select all

WinHasMenu(WinTitle:="") {
    return !!DllCall("GetMenu", "ptr", WinExist(WinTitle), "ptr")
}
#If WinHasMenu("A") || WinActive("Searching menus of: ahk_class AutoHotkeyGUI")
So I used that DllCall line to test Notepad++, got a legit value of 7345837. Tried it for Cisco Webex Meetings and get 0. :( So looks like we confirmed that Webex does not have a true menu, which means the only option I think I have at this point is to use WinActivate + Send. Thanks for info!
User avatar
geekyadam
Posts: 31
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

24 Jan 2019, 12:03

jeeswg wrote:
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.
Great info. I tried a bunch of them but was not able to activate a given menu item. The benefit of that method would be nice because I could select the menu items without needing to activate the window. If someone could confirm for me exactly which SendMessage/PostMessage command(s) will activate a given menu item (even if another line is needed to activate the parent menu first), I'd appreciate it. Otherwise I can't go that route. I might Google that a bit tho to look into it more. Thanks.
User avatar
geekyadam
Posts: 31
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

24 Jan 2019, 12:21

SOTE wrote:
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
That's some great window information identification code there. It shows info that AHK's built-in Active Window Info script doesn't show. I used it to find the ahk_id for the Cisco Webex Meetings window as well as the Participant menu option, and tried to use both with any variation of ControlSend I could think of but I still can't get ControlSend to activate the toggle shortcut (Ctrl+m) or activate any the menus (Alt+p and Alt+u). Thanks for the help though!
User avatar
geekyadam
Posts: 31
Joined: 01 Aug 2016, 17:11

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

24 Jan 2019, 13:49

Since we confirmed I won't likely be able to use WinMenuSelectItem or even ControlSend to mute/unmute myself in Webex, this is what I came up with. As I suspected, the Webex window is a bit latent in recognizing sent keys, so I had to add a couple Sleeps in there to accomodate. Works pretty well at this point.

Code: Select all

; mute/unmute Webex
!pgup::
	current_ID =
	if !WinActive("Cisco Webex Meetings")
	{
		WinGet, current_ID, ID, A
		WinActivate Cisco Webex Meetings
		WinWaitActive Cisco Webex Meetings,, 2
		if ErrorLevel = 1
		{
			msgbox Cisco Webex Meetings window activation timed out.
			return
		}
	}
	Send {CTRL DOWN}{m DOWN}
	Sleep 200
	Send {m UP}
	Sleep 200
	Send {CTRL UP}
	if current_ID
		WinActivate ahk_id %current_ID%
return
FYI my mouse has four buttons on the side, the lower two are the default XButton1 and XButton2 (normally Back and Forward actions within Windows/browsers/etc). The upper two are mapped to Page Up and Page Down. And I use Alt for my work-specific hotkeys. So Alt + one of the side buttons on my mouse will activate webex window, send necessary keys, and switch back to previous window.

Thanks again to everyone for all their help and information, I learned a lot during this journey! I'm going to mark this reply as the answer just for future reference by others.
SOTE
Posts: 657
Joined: 15 Jun 2015, 06:21

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

24 Jan 2019, 14:02

Good to see it worked out for you. And by posting your solution, you might help some other person using Cisco Webex Meetings.
User avatar
jeeswg
Posts: 6469
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

27 Jan 2019, 14:32

If you can see the context menu IDs with the 'Get Info from Context Menu' script, then you can try them with PostMessage/SendMessage.

Code: Select all

q:: ;Notepad - invoke Open...
WinGet, hWnd, ID, ahk_class Notepad
PostMessage, 0x111, 2,,, % "ahk_id " hWnd ;WM_COMMAND := 0x111 ;Open...
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
geekyadam
Posts: 31
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

29 Jan 2019, 10:03

SOTE wrote:
24 Jan 2019, 14:02
Good to see it worked out for you. And by posting your solution, you might help some other person using Cisco Webex Meetings.
Yeah that's my hope.
User avatar
geekyadam
Posts: 31
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

29 Jan 2019, 10:11

jeeswg wrote:
27 Jan 2019, 14:32
If you can see the context menu IDs with the 'Get Info from Context Menu' script, then you can try them with PostMessage/SendMessage.

Code: Select all

q:: ;Notepad - invoke Open...
WinGet, hWnd, ID, ahk_class Notepad
PostMessage, 0x111, 2,,, % "ahk_id " hWnd ;WM_COMMAND := 0x111 ;Open...
return
I did try that actually, I just couldn't get it to work sadly. If you're interested in trying it out, you can DM me and I can spin up a temporary Webex room for you to join and try anything you can think of. Just let me know. :)
User avatar
jeeswg
Posts: 6469
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

31 Jan 2019, 15:45

- A few possibilities, which may or may not work.
- You could try ControlSend and PostMessage on each control, rather than the main window.
- You could also try sending other message numbers, e.g. something that does something obvious like 'File, Open...'. E.g. I might try brute force sending message IDs in case anything happens, but be careful in case any messages might have consequences, I might therefore send messages slowly.
- You could also try WM_SYSCOMMAND := 0x112.

- You could also try Acc to invoke menu items. I would expect that using Acc would work.
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
fredless
Posts: 1
Joined: 19 Apr 2019, 10:48
GitHub: fredless

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

19 Apr 2019, 10:50

looking for the same things, and inspired by @geekyadam 's attempts, sharing what I came up with, so far: https://github.com/fredless/WebexMeetingMute
SOTE
Posts: 657
Joined: 15 Jun 2015, 06:21

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

20 Apr 2019, 00:03

fredless wrote:
19 Apr 2019, 10:50
looking for the same things, and inspired by @geekyadam 's attempts, sharing what I came up with, so far: https://github.com/fredless/WebexMeetingMute
Nice. You and geekyadam might want to consider using SendInput instead of Send, as it's less likely to be interfered with. In addition, maybe look at BlockInput On/Off above and below a series of Send or SendInput commands, to guarantee they are not interfered with. This is something to consider, especially in situations where you are not or can't use ControlSend or ControlClick, when dealing with non-standard GUIs.
User avatar
geekyadam
Posts: 31
Joined: 01 Aug 2016, 17:11

Re: WinMenuSelectItem and ControlSend not working with Cisco Webex Meetings

23 Apr 2019, 09:05

fredless wrote:
19 Apr 2019, 10:50
looking for the same things, and inspired by @geekyadam 's attempts, sharing what I came up with, so far: https://github.com/fredless/WebexMeetingMute
Just checked out your github page, nice work. It would probably be beneficial to link back to this page in case anyone wants to see more info on issues sending keys to Webex windows just for reference. Also, I noticed your script allows muting and unmuting specifically, rather than toggling. To support that I see you're just using simple sends of [Codebox]Send !pm[/Codebox] and [Codebox]Send !pu[/Codebox]. I tried using those same sends but it was not reliable (sometimes would work many other times it would not). Are you able to use those simplified sends without sleeps in between for latency like I had to?

Return to “Ask For Help”

Who is online

Users browsing this forum: Discordia1408, flyingDman, Jay Meazy, Klark92, TAC109, Wontyd and 226 guests