09-11-2009, 01:46 PM
Hi,
I am not sure what you want to get. But may the next part of code will help you.
Open "My Documents" and run (<Item 5> in my case has submenu):
I am not sure what you want to get. But may the next part of code will help you.
Open "My Documents" and run (<Item 5> in my case has submenu):
Code:
strWin = "My Documents"
Window("regexpwndtitle:="&strWin).Activate
wait 1
Window("regexpwndtitle:="&strWin).WinListView("regexpwndclass:=SysListView32").Select 0,micRightBtn
wait 2
Set oContMenu = Window("regexpwndtitle:="&strWin).WinObject("regexpwndclass:=SHELLDLL_DefView").WinMenu("menuobjtype:=3")
nCnt = oContMenu.GetItemProperty("", "SubMenuCount")
strMenu = oContMenu.GetItemProperty("<Item 5>", "Label") '// will return the menu string
Window("regexpwndtitle:="&strWin).WinListView("regexpwndclass:=SysListView32").Select 0,micRightBtn
bRes = oContMenu.GetItemProperty("<Item 5>", "HasSubMenu") '// if it has sub menu
wait 2
If bRes Then
Window("regexpwndtitle:="&strWin).WinListView("regexpwndclass:=SysListView32").Select 0,micRightBtn
wait 2
oContMenu.Select strMenu
nCnt2 = oContMenu.GetItemProperty("<Item 5>", "SubMenuCount")
strMenu2 = oContMenu.GetItemProperty("<Item 5>;<Item 1>", "Label") '// will return the menu string
End If