Morgan
12 years agoFrequent Contributor
Selecting the application in the tray
I have a strange problem...
I modified the script located here to click on an item in the tray. When this icon is clicked, it launches a menu and from there I want to select an item from that menu.
However, I find that RIGHT after my tray application is launched and appears in the tray, TC cannot locate it and fails with the error that the control item 'APPNAME' was not found. Bolded below is where it fails. Odder still is if I MANUALLY click the tray icon and then the menu, TC can THEN successfully locate the tray item. It is only when the tool is first loaded and first appears in the tray that this is an issue.
Any thoughts?
This is 8.7 on an XP machine, if it makes a difference.
Thanks,
Morgan
--------
Sub RightClickTrayIcon(Name, MenuItem)
'Expands the tray and accesses the application
Set p = Sys.Process("Explorer")
Set tray = p.Window("Shell_TrayWnd").Window("TrayNotifyWnd")
Set show_button = tray.WaitWindow("Button", "")
aqUtils.Delay(1000)
'Right-clicks the application icon
tray.Window("SysPager").Window("ToolbarWindow32", "Notification Area").ClickItemR(Name)
'Selects an item from the context menu
tray.PopupMenu.Click(MenuItem)
Delay(1000)
End Sub
I modified the script located here to click on an item in the tray. When this icon is clicked, it launches a menu and from there I want to select an item from that menu.
However, I find that RIGHT after my tray application is launched and appears in the tray, TC cannot locate it and fails with the error that the control item 'APPNAME' was not found. Bolded below is where it fails. Odder still is if I MANUALLY click the tray icon and then the menu, TC can THEN successfully locate the tray item. It is only when the tool is first loaded and first appears in the tray that this is an issue.
Any thoughts?
This is 8.7 on an XP machine, if it makes a difference.
Thanks,
Morgan
--------
Sub RightClickTrayIcon(Name, MenuItem)
'Expands the tray and accesses the application
Set p = Sys.Process("Explorer")
Set tray = p.Window("Shell_TrayWnd").Window("TrayNotifyWnd")
Set show_button = tray.WaitWindow("Button", "")
aqUtils.Delay(1000)
'Right-clicks the application icon
tray.Window("SysPager").Window("ToolbarWindow32", "Notification Area").ClickItemR(Name)
'Selects an item from the context menu
tray.PopupMenu.Click(MenuItem)
Delay(1000)
End Sub