Double click on static text

Nov 22, 2013 at 7:28 AM
Hi All,
I have an application, which has a static text "ABC" . I have to double click on that to invoke an application.

There is no invokable patterns observed when i run "UIAutomationSpy", and point to that statis text. Please let me know how can i achived that.

Thanks a lot
Nov 22, 2013 at 7:37 AM
Infact... i would like to move a mouse to a point anywhere in the window using "Move-UIACursor" and want to do the following click, double click, right click (with / without control)... please let me way to do it...
Coordinator
Nov 22, 2013 at 7:44 AM
Hi,
try Invoke-UIAControlClick with parameters. It usually consumes an AutomationElement, and also can work after Move-UIACursor.
Sometimes, an application has it's own opinion what is a double click - in this case, I need a piece of output of Spy++.
Usually, the standard double click works.
Nov 22, 2013 at 7:53 AM
Sure.. will provide spy++ output soon, in the meanwhile.. just wonder.. can i go to any place in window and click blindly (irrespective of control).. that helps a lot in automation.. i feel...
Coordinator
Nov 22, 2013 at 9:53 AM
Edited Nov 22, 2013 at 10:03 AM
The Get-UIAControlClick cmdlet needs a handle.
How to get a handle of a thing that has no handle?
There are two ways:
1) if your label is recognizable as AutomationElement, you could simply run the following:
Get-UIAWindow ..... | Get-UIA[your static label] | Invoke-UIAControlClick -DoubleClick;
Even if your control does not have handle, the Invoke-UIAControlClick cmdlet gets its parent, or its 'grandparent', etc, until it gets a control with handle. After that, the cmdlet calculates X and Y and hits to the place your handless control is.
2) If your label is not recognizable as AutomationElement, you need to get an upper element (on what your label is painted), move the cursor and use the same cmdlet:
Get-UIAWindow ..... | Get-UIA[the parent of your static label] | Move-UIACursor -X ... -Y ... | Invoke-UIAControlClick -DoubleClick;
Here could be a problem: if you selected its further ancestor, on which its parent is placed, and both parent and further ancestor have handles, the cmdlet hits ancestor, not the parent. This could be heard as a glass sound (as when you click onto that is not considered to be clickable like a window under a modal window).
Shortly, you need to choose exactly the control with handle on that your label is painted, and hit there.

Sometimes, an app has its own opinion about what the double click is. Double click is usually two clicks with WM_MOUSEMOVE in between (as spy++ says). However, automated double click on calc.exe is not the same as you perform it manually (your hand is simply too slow for calc :)).
Start-Process calc -PassThru | Get-UiaWindow | Get-UiaButton 5 | Invoke-UiaControlClick -DoubleClick;
If you perform a double click on a button, you've got two digits in the text box.
Nov 22, 2013 at 6:04 PM
Ohh.. if the automated double click is not same as manual DoubleClick.. how do i achieve manualClick effect....
Is there any way...

I tried the following code...

Start-Process services.msc -PassThru | Get-UIAWindow | Move-UIACursor -X 400 -Y 475 ;
Get-UIAControlFromPoint | Invoke-UIAControlClick -DoubleClick;

Manual double click invokes the program, where as the above code didnt work as manual. " Single Click and Right click" working fine..
Nov 22, 2013 at 7:15 PM
it looks... when we start services.. immediately... we are not able to double click.. this code works


Start-Process services.msc -PassThru | Get-UIAWindow | Move-UIACursor -X 400 -Y 475 ;
Get-UIAControlFromPoint | Invoke-UIAControlClick;
Get-UIAControlFromPoint | Invoke-UIAControlClick -DoubleClick;
Coordinator
Nov 22, 2013 at 8:27 PM
The last code you provided performs double click on my host (Win 8 x64).
The second line of code clicks out the tooltip, and the third line of code opens the dialog (i.e., performs a double click).

The problem is that out double click is a 'classic' double click, it was got from spy++ output.
However, some apps like that there was a bigger time interval between the first and the second click, as a user clicks. This is as if we run the following:
Get-Uia.... | Invoke-UIAControlClick | Invoke-UIAControlClick
In this case, services.msc, the first click was needed to get rid of the tooltip, right?
Nov 23, 2013 at 9:49 AM
My Object retruning Get-UIAText, Can i invoke , Click and DoubleClick on this?
I been trying from past 1 hr,

Get-UIAWIndow...| Get-UIAText -Name ... | Invoke-UIAControlClick -DoubleClick;

It is not throwing any error.. where as action not taking place.....
Coordinator
Nov 23, 2013 at 12:58 PM
Edited Nov 23, 2013 at 1:00 PM
What type of control is this Text?
It's unlikely to have InvokePattern (what do UIAutomationSpy and UIAVerify say about the control?).
However, if your control accepts clicks, there should be one that fits.
Are you sure that the control accepting clicks is Text? Maybe, this is one of visible controls under the Text or a control you couldn't see as it's under the Text and has the same size and shape? Sometimes what is clickable could be not the same control you expect to be clickable.

The Invoke-UIAControlClick cmdlet works with handle. If you think that you need to click Text and you click Text via its handle, the control that in fact is awaiting for click gets nothing.
Nov 23, 2013 at 1:17 PM
UIAutomationSpy - showing

Get-UIAText -AutomationId '...' -Class 'Static' -Name 'Start Application' -Win32;

This window has a pane, in that pane there are some icon with start and stop application, when i do mouse click, it is getting selected, when i do double click, then it is opening up a new window.

Thanks and Regards,
Ravi Kumar Malla
Coordinator
Nov 25, 2013 at 7:29 AM
Some applications accept two clicks as a double click. I played with explorer.exe on Windows 8 x64, having a folder opened and its items in the 'Big Icons' mode:
# in the folder C:\1, trying to open folder C:\1\1
# this does not work:
Get-UiaWindow -n 1 | Get-UiaListItem -n 1 | Invoke-UiaControlClick -DoubleClick;

# this works
Get-UiaWindow -n 1 | Get-UiaListItem -n 1 | Invoke-UiaControlClick | Invoke-UiaControlClick
I even added the interval between the time mouse's button is moving down and up (the left button gets down, after that a half of interval, after that a mousemove action that always was there , after that the second hald of the interval, after that the button goes up), explorer ignores the double click, accepting only two single clicks :)
Get-UiaWindow -n 1 | Get-UiaListItem -n 1 | Invoke-UiaControlClick -DoubleClick -DoubleClickInterval 100;
Get-UiaWindow -n 1 | Get-UiaListItem -n 1 | Invoke-UiaControlClick -DoubleClick -DoubleClickInterval 500;
Get-UiaWindow -n 1 | Get-UiaListItem -n 1 | Invoke-UiaControlClick -DoubleClick -DoubleClickInterval 1000;
Get-UiaWindow -n 1 | Get-UiaListItem -n 1 | Invoke-UiaControlClick -DoubleClick -DoubleClickInterval 2000;
It's better that you spy the control with spy++ when you do what it accepts as a double click.
Coordinator
Mar 13, 2014 at 7:34 AM
Hi,
versions of UIAutomation 0.8.7 Beta 2 and higher bring to the community new ways to click and send keys.
Look at this [the Mouse property]