This project is read-only.
There is a post.
As an additional example, we are going to report which tooltips have been opened since our sample had been run. We register TooltipOpenedEvent on the desktop object:
$elements = New-Object System.Collections.ArrayList;
Get-UIADesktop | Register-UIAToolTipOpenedEvent -EventAction { param($src, $e) $elements.Add($src.Current.Name); };
After hovering over items in Taskbar
TooltipOpenedEvent001.jpg
my output was
"Windows PowerShell ISE"
"You are running out of disk space on Podcasts (G:).
Click here to see if you can free space on this drive."
"You are running out of disk space on Local Disk (E:).
Click here to see if you can free space on this drive."
"Windows PowerShell ISE"

Similarly, we can add registration for TooltipClosedEvent. In the script below, we add registration for both opening and closing tooltip events. The scripts fills the array list, allowing us to match opening and closing events by their windows' handles:
$elements = New-Object System.Collections.ArrayList;
Get-UIADesktop | Register-UIAToolTipOpenedEvent -EventAction { param($src, $e) $elements.Add("opened:"); $elements.Add($src.Current.Name); $elements.Add($src.Current.NativeWindowhandle); }
Get-UIADesktop | Register-UIAToolTipClosedEvent -EventAction { param($src, $e) $elements.Add("closed:"); $elements.Add($src.Current.NativeWindowhandle); }

Tags: TooltipOpenedEvent, TooltipClosedEvent

Last edited Jan 23, 2013 at 8:22 PM by xinliu, version 5

Comments

No comments yet.