Jump to content

ControlClick command over TTntPanel.UnicodeClass buttons.


Go to solution Solved by water,

Recommended Posts

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.

Link to comment
Share on other sites

  • Solution

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Or even

ControlClick($txtApTitle, "", 2559052)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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?

 

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...