Daily automation: hunting down system tooltips


Task: your application displays a tooltip in the TaskBar or on the screen if it’s running on a Windows 8 computer. Maybe, you are interested in reporting when, which, how, in which order, and so on, the end user works with minimized applications in the TaskBar. The task is to report or react to these types of user’s activity.

Requirements: your script should report or perform an action in cases the user inserted or removed a flash disk, or choosing an application to maximize moving the cursor over the TaskBar.

Solution: all what you needed is to use the ToolTipOpened event. That’s all, it’s easy. Below is the code:

Set-StrictMode -Version Latest;
ipmo [path]\UIAutomation.dll;
Get-UIADesktop | Register-UIAToolTipOpenedEvent -EventAction {param($src, $e) "name: $($src.Cached.Name)" >> C:\1\1.txt; "auId: $($src.Cached.AutomaitonId)" >> C:\1\1.txt;}

After starting the sample, the file C:\1\1.txt will be a place that you can call your user’s diary.

It’s the typical content of the file (I inserted and removed two flash disks and opened small application screenshots (as shown in the picture above):

name: The ‘USB Mass Storage Device’ device can now be safely removed from the computer.

auId:

name: The ‘USB Mass Storage Device’ device can now be safely removed from the computer.

auId:

name: Solve PC issues: 2 messages

auId:

name: @AutoPlay ‪Removable Disk (L:)‬, Tap to choose what happens with removable drives.

auId:

name: Administrator: Windows PowerShell

auId:

name: Sign In – Windows Internet Explorer

auId:

name: Add New Post ‹ Software testing automation based mostly on PowerShell — WordPress https://softwaretestingusingpowershell.wordpress.com/wp-admin/post-new.php

auId:

Advertisements

2 responses

  1. Great post! I was looking for software test automation techniques. Please suggest the best tools and tips.

  2. A better tool? There is only one tool for the SoftwareTestingUsingPowerShell team, and this is PowerShell with software testing modules. PowerShell is a standard language supported by Microsoft and it also supports .NET, COM, WMI. Thus, it’s the best tool, in most respects, for testing on the Windows platform and even can be used for Web testing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: