Josh_147
6 years agoContributor
How to check menu item's state that popup by right click
Hi all. I'm using TC11 with VBScript and I'm trying to know the popup menu item is checked or unchecked. I studied Checking Menu Item's State but the structure of Notepad is different compare with my application. This is what I get from Additional Info after I ran the keyword test:
Tested object:
Aliases.RobotArm.wndRobotArm.Afx.AfxWnd90u.PopupMenu
(Sys.Process("RobotArm").Window("Afx:00007FF6A9B70000:0", "RobotArm", 1).Window("Afx:00007FF6A9B70000:b:0000000000010003:0000000000000006:0000000000000000", "", 1).Window("AfxWnd90u", "Image View 1", 10).PopupMenu)
Aliases.RobotArm.wndRobotArm.Afx.AfxWnd90u.PopupMenu
(Sys.Process("RobotArm").Window("Afx:00007FF6A9B70000:0", "RobotArm", 1).Window("Afx:00007FF6A9B70000:b:0000000000010003:0000000000000006:0000000000000000", "", 1).Window("AfxWnd90u", "Image View 1", 10).PopupMenu)
Sub Test Dim w Set w = Sys.Process("RobotArm").Window("Afx:00007FF6A9B70000:0", "RobotArm", 1).Window("Afx:00007FF6A9B70000:b:0000000000010003:0000000000000006:0000000000000000", "", 1).Window("AfxWnd90u", "Image View 1", 10) If w.PopupMenu.Items(8).Checked Then Call Log.Message ("The ""Light"" option is checked.") Else Call Log.Message ("The ""Light"" option is unchecked.") End If End Sub
I applied it into the script and run the keyword test but the error shows "Cannot obtain the popup menu."
Possible reason: There was no click that invokes the popup menu.
I suspect the reason is due to Afx window but I have no idea how to deal with it. Does anyone know how to fix this? Thanks in advance.
Hi TanyaYatskovska ,
I had tried to change the index number and there is no more issue. Thanks a lot!