Alright, I really have been searching on both the net and here within the forums. I am trying to access all the objects in the systray to then RIGHT-CLICK the target object which will promote the app-menu allowing me to choose one of the commands within the menu. I have seen the "Reset-Tray" code, and am using quite a bit of it (thanks, Joel!), but am trying to drill down further to get the NextChild and Siblings I see within UI Spy ... no luck so far ... grrrrr ...
Here's the code I have so far:
function List-MySystrayItems{
Add-Type -Assembly UIAutomationClient
# The goal is to isolate the two areas in the systray: notification area
# and system control area
#
$loadedSet = [System.Windows.Automation.AutomationElement]::RootElement.FindAll( "Descendants" , [System.Windows.Automation.Condition]::TrueCondition ) |
Where { $_.GetCurrentPropertyValue([System.Windows.Automation.AutomationElement]::ClassNameProperty) -like "SysPager" } |
ForEach { $_.FindAll( "Children" , [System.Windows.Automation.Condition]::TrueCondition ) } |
Where { $_.GetCurrentPropertyValue([System.Windows.Automation.AutomationElement]::NameProperty) -like "*Notif*" }
# just show how many items were found - if more than one, problem
#
Write-Output "Getting set info: '$loadedSet'"
# Begin to drill down into the NextChild items and list the Siblings
#
$setName = $loadedSet.GetCurrentPropertyValue([System.Windows.Automation.AutomationElement]::NameProperty)
Write-Output "setName: '$setName'"
$indItem0 = $loadedSet.FindAll( "Subtree" , [System.Windows.Automation.Condition]::TrueCondition )
Write-Output "indItem0: '$indItem0'"
}
I get the last element, there in variable '$indItem0' which then I believe contains the items I need. I am not able to get the list, however, using the code I know - and have found.
I am going to keep hammering away, but any help I can get that will make this faster, I would greatly appreciate it!
--steve
|