Sign in to follow this  
Followers 0
akn

How to click static text

8 posts in this topic

Hello,

I have to click a static text which is on a windows gui application (built on c#), click takes to another window. Tried with ControlClick() and with MouseClick() after getting the x & y coordinates using ControlGetPos(), but no luck :-( am clueless how to do static text clicks.

Plz. find the below summary for Window and Control, which I should click

>>>> Window <<<<

Title: ScanWindow

Class: WindowsForms10.window.8.app.0.201d787

Position: 379, 6

Size: 650, 411

Style: 0x1EC80000

ExStyle: 0x00050500

Handle: 0x0002050C

>>>> Control <<<<

Class: WindowsForms10.STATIC.app.0.201d787

Instance: 2

ClassnameNN: WindowsForms10.STATIC.app.0.201d7872

Advanced (Class): [CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]

ID: 459988

Text: Edit

Position: 557, 133

Size: 25, 15

ControlClick Coords: 17, 7

Style: 0x5601000D

ExStyle: 0x00000000

Handle: 0x000704D4

Thoughts/workarounds/suggestion are highly appreciated.

Thanks in Advance

Regards,

--AK.

Share this post


Link to post
Share on other sites



ControlClick(HWnd(0x0002050C),"","[CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]")

Since the handle will change, you can change the first parameter to either the window title ("ScanWindow") or it's classname: "[CLASS:WindowsForms10.window.8.app.0.201d787]"

Share this post


Link to post
Share on other sites

ControlClick(HWnd(0x0002050C),"","[CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]")

Since the handle will change, you can change the first parameter to either the window title ("ScanWindow") or it's classname: "[CLASS:WindowsForms10.window.8.app.0.201d787]"

Thanks for your quick reply. Tried but no luck :-)

Any more thoughts???

Share this post


Link to post
Share on other sites

Try this:

$hWND = WinGetHandle ("ScanWindow")
$hControl = ControlGetHandle ($hWND, "", "[CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]")

$ret = ControlClick ($hWND, "", $hControl)
MsgBox (0, "", $ret)

I'm not entirely sure if what is returned by AutoIt window is correct. Are you sure you're getting the right things from the window?

Cheers,

Brett

Share this post


Link to post
Share on other sites

Try this:

$hWND = WinGetHandle ("ScanWindow")
$hControl = ControlGetHandle ($hWND, "", "[CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]")

$ret = ControlClick ($hWND, "", $hControl)
MsgBox (0, "", $ret)

I'm not entirely sure if what is returned by AutoIt window is correct. Are you sure you're getting the right things from the window?

Cheers,

Brett

$ret = ControlClick ($hWND, "", $hControl), does return 1 - success, whereas it does not simulate click event on the linked text (Edit)

Any more thoughts???

Regards,

--AK

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I get the same trouble, who can help me?

Thanks in Advance.

The Window and Contrl info as below:

>>>> Window <<<<

Title: ImageViewer

Class: #32770

Position: 64, 35

Size: 1026, 872

Style: 0x94CA00C4

ExStyle: 0x00050111

Handle: 0x00180722

>>>> Control <<<<

Class: Static

Instance: 7

ClassnameNN: Static7

Advanced (Class): [CLASS:Static; INSTANCE:7]

ID: 1033

Text:

Position: 249, 645

Size: 162, 162

ControlClick Coords: 50, 61

Style: 0x5000100E

ExStyle: 0x00020004

Handle: 0x0009073A

Edited by Shibin

Share this post


Link to post
Share on other sites

Are you sure it's a standard window label or it's an user made, custom label? The classnameNN looks weird

Share this post


Link to post
Share on other sites

I got around this problem using ControlSend:

ControlSend($WindowTitle,"","[CLASS:WindowsForms10.STATIC.app.0.2004eee; INSTANCE:40]","{ENTER}")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0