I am having trouble manipulating the pop-up window that appears when you right-click an icon in the windows tray.

1. First I tried simply recording.
This ended up with the following lines of code:

Tray.Syspager.Toolbar.[Icon].Click (2)
Tray.Syspager.Toolbar.Icon.PopupSelect (x, y, "menu_item1")
Tray.Syspager.Toolbar.Icon.PopupSelect (x, y, "menu_item2")
Tray.Syspager.Toolbar.Icon.PopupSelect (x, y, "menu_item3")
Tray.Syspager.Toolbar.Icon.PopupSelect (x, y, "menu_item4")

This code correctly displays the pop-up menu and will correctly click on menu_item1 consistently but after that it will fail at random. Sometimes it will correctly click all menu items. Sometimes it will fail and complain that a specific menu item cannot be found.

2. Then I tried implementing my own popupmenu class.

winclass MyPopupMenu : PopupMenu
POINT point
tag "$PopupMenu/({Point.x},{Point.y})
MenuItem menu_item1
tag "menu_item1"
MenuItem menu_item2
tag "menu_item2"

Code for selecting then looks like this:

Tray.Syspager.Toolbar.Icon.rMenu.menu_item1.Pick ()

With this code SilkTest errors out on all menu items saying they cannot be found. So I tried to see what SilkTest was seeing in my popup menu.

Tray.Syspager.Toolbar.Icon.rMenu.GetItemCount ()
correctly returns 5 (there are 5 items in this popup).

Tray.Syspager.Toolbar.Icon.rMenu.GetContents ()
returns a blank list.

However, SilkTest DOES see the menu items as children of the popup menu since a call to:
Tray.Syspager.Toolbar.Icon.rMenu.GetChildren ()
returns a complete list of all 5 menu items.

I just can't figure out how to consistently select the items in the popup menu. If anyone has any ideas it would be very appreciated.

If there is any further information you think I should provide please let me know.

Thanks in advance.

P.S. A lot of what I have tried to solve this issue has come from searching this board already. I want to thank everyone who ever responded to a question about popup menus. Popup menus seem to be a very common roadblock for SilkTest users.