Sign in to follow this  
Followers 0
Martinezio

ControlClick command over TTntPanel.UnicodeClass buttons.

10 posts in this topic

Hi all.

I have a trouble to send ControlClick command to TTntPanel.UnicodeClass.

I need to click on specified button on this control, but I don't know how to do this.

Here are coords from AutoIt Window Info:

>>>> Control <<<<
Class:  TTntPanel.UnicodeClass
Instance:   2
ClassnameNN:    TTntPanel.UnicodeClass2
Name:   
Advanced (Class):   [CLASS:TTntPanel.UnicodeClass; INSTANCE:2]
ID: 2559052
Text:   
Position:   1643, 2
Size:   285, 43
ControlClick Coords:    160, 20
Style:  0x56000000
ExStyle:    0x00010000
Handle: 0x00270C4C

>>>> Mouse <<<<
Position:   1805, 24
Cursor ID:  0
Color:  0x000000

My code that in my opinion should work is:

ControlClick($txtApTitle, "", "[CLASS:TTntPanel.UnicodeClass; INSTANCE:2]", "primary", 1, 160, 20)

but this line doesn't work :(

I cannot use mouse events, because its coordinates can be different on other computer. Only coordinates within control doesn't change.

Can any of You help me with this?

Thank You in advance.

Best regards,

Martin.

Share this post


Link to post
Share on other sites



Welcome to AutoIt and the forum!

Do you need to specify the coordinates where to click in the control?

Does

ControlClick($txtApTitle, "", "[CLASS:TTntPanel.UnicodeClass; INSTANCE:2]")

work?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Or even

ControlClick($txtApTitle, "", 2559052)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Welcome to AutoIt and the forum!

Do you need to specify the coordinates where to click in the control?

Does

ControlClick($txtApTitle, "", "[CLASS:TTntPanel.UnicodeClass; INSTANCE:2]")

work?

 

It works now, because it hits into left border of the proper button, but I don't know if it will work on different computer.

Why it doesn't work with the coordinates?

PS: I cannot use ID - it changes with every new instance of the controlled programm, which is started by my script.

Thank You for Your support.

Martin.

Edited by Martinezio

Share this post


Link to post
Share on other sites

Why it doesn't work with the coordinates?

Don't know. I assume the coordinates are relative to the top left corner of the control. So the coordinates you specified might not be inside of the control.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Ok. I think it should be inside, because I used coords given from the AutoIt Window Info tool.

Whatever. Currently script works fine, so this thread may be closed :)

Thank You once again.

Best Regards,

Martin.

Share this post


Link to post
Share on other sites

Ok. I think it should be inside, because I used coords given from the AutoIt Window Info tool.

You mean the coords named as "ControlClick Coords"?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Yes, exactly.

I grab "Finder tool" and go with it over desired position to click and read ControlClick Coords from Info tool.

This coords are always lower than Size values, so they must be inside control.

Here is entire (well, not quite ;) I've changed application name, but it doesn't matter ;) ) script:

AutoItSetOption("WinTitleMatchMode", 1)
;AutoItSetOption("MouseCoordMode", 3)

Local $txtApTitle = "Some nasty application"

If Not WinExists($txtApTitle) Then
   Run("C:\path\app.exe")
   WinWaitActive($txtApTitle)
   
   If WinGetState($txtApTitle) <> 32 Then
      WinSetState($txtApTitle, "", @SW_MAXIMIZE)
   EndIf
Else
   if Not WinActive($txtApTitle) Then
      WinActivate($txtApTitle)
   EndIf
EndIf

If @error Then
   MsgBox(4096, "Błąd", "Aplikacja nie działa prawidłowo.")
Else
   ; Okno znalezione - można przystąpić do zarządzania nim.
   Send("{F1}")
   Send("Q")
   If ControlCommand($txtApTitle, "", "[CLASS:TTntPanel.UnicodeClass ;INSTANCE: 2", "IsVisible", "") Then MsgBox ControlGetText($txtApTitle, "", "[CLASS:TTntPanel.UnicodeClass ;INSTANCE: 2")
   ControlClick($txtApTitle, "", "[CLASS:TTntPanel.UnicodeClass; INSTANCE:2]")
EndIf

I've also commented out second line, but I don't remember when exactly ;) I try to check if it changes the behaviour of ControlClick also... Some time earlier I was trying to play with MouseClick... Without success, so I use ControlClick function.

Edited by Martinezio

Share this post


Link to post
Share on other sites

So your coords seem to be valid.

Does

ControlClick($txtApTitle, "", "[CLASS:TTntPanel.UnicodeClass; INSTANCE:2]", Default, Default, 160, 20)

work?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

No, this command doesn't work.

I checked also the setting for MouseCoordMode, but it doesn't change the behaviour.

Something is wrong about ControlClick function - maybe something was changed by developers and they forget to fix it in documentation? ;)

Edited by Martinezio

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