Sign in to follow this  
Followers 0
injoin

How to click a TPanel?

5 posts in this topic

AutoIt Window Info shows a botton made with TPanel (in Delphi?) as

CODE
>>>> Control <<<<

Class: TPanel

Instance: 1

ClassnameNN: TPanel1

Advanced (Class): [CLASS:TPanel; INSTANCE:1]

ID: 1444872

Text:

Position: 0, 0

Size: 631, 49

ControlClick Coords: 528, 16

Style: 0x56000000

ExStyle: 0x00010200

Handle: 0x00160C08

How do I click on this TPanel?

ControlClick("my program title", "", "[CLASS:TPanel; INSTANCE:1]") does not work

Any comments are appreciated.

Thank you

Share this post


Link to post
Share on other sites



AutoIt Window Info shows a botton made with TPanel (in Delphi?) as

CODE
>>>> Control <<<<

Class: TPanel

Instance: 1

ClassnameNN: TPanel1

Advanced (Class): [CLASS:TPanel; INSTANCE:1]

ID: 1444872

Text:

Position: 0, 0

Size: 631, 49

ControlClick Coords: 528, 16

Style: 0x56000000

ExStyle: 0x00010200

Handle: 0x00160C08

How do I click on this TPanel?

ControlClick("my program title", "", "[CLASS:TPanel; INSTANCE:1]") does not work

Any comments are appreciated.

Thank you

ControlClick("Formtoclick","","[CLASS:TPanel;INSTANCE:1]")

Works for me.

If you are running the Delphi exe from the Delphi IDE then you might have another form (window) with the same title, so change Form1.caption in FormCreate to be different, and make sure your ControlClick matches of course.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ControlClick("Formtoclick","","[CLASS:TPanel;INSTANCE:1]")

Works for me.

If you are running the Delphi exe from the Delphi IDE then you might have another form (window) with the same title, so change Form1.caption in FormCreate to be different, and make sure your ControlClick matches of course.

I'm not running the program from Delphi IDE.

My code is as following.

ControlClick("ISP Utility", "Auto", "[CLASS:TBitBtn; INSTANCE:7]")

and

ControlClick("ISP Utility", "", "[CLASS:TBitBtn; INSTANCE:1]")

works. But

ControlClick("ISP Utility", "", "[CLASS:TPanel; INSTANCE:1]")

don't work.

Are there any ways that I can debug?

Tanks

Dim $dialog_text

If WinExists("ISP Utility") = 1 Then
    If (ControlClick("ISP Utility", "Auto", "[CLASS:TBitBtn; INSTANCE:7]") = 1) Then
        If ControlClick("ISP Utility", "", "[CLASS:TBitBtn; INSTANCE:1]") And ControlClick("MStar ISP Utility", "", "[CLASS:TPanel; INSTANCE:1]") Then
;If (ControlClick("ISP Utility", "Run", "[CLASS:TBitBtn; INSTANCE:11]") = 1) Then
    ;MsgBox(0, "", "Success")
            If WinWait("Dialog", "", 5) = 0 Then Exit(1)
            $dialog_text = ControlGetText("Dialog", "", "[CLASS:Static; INSTANCE:2]")
            If @error = 1 Then
                MsgBox(0, "", "get dialog text failed")
                Exit(2)
            Else
                MsgBox(0, "Dialog", "Text = " & $dialog_text)
            EndIf
        Else
            MsgBox(0, "", "Failed")
        EndIf
    Else
        MsgBox(0, "", "Click auto Failed")
    EndIf
    
Else
    MsgBox(0, "Error", "ISP tool not activated")
EndIf
Edited by injoin

Share this post


Link to post
Share on other sites

I'm not running the program from Delphi IDE.

My code is as following.

ControlClick("ISP Utility", "Auto", "[CLASS:TBitBtn; INSTANCE:7]")

and

ControlClick("ISP Utility", "", "[CLASS:TBitBtn; INSTANCE:1]")

works. But

ControlClick("ISP Utility", "", "[CLASS:TPanel; INSTANCE:1]")

don't work.

Are there any ways that I can debug?

Tanks

Dim $dialog_text

If WinExists("ISP Utility") = 1 Then
    If (ControlClick("ISP Utility", "Auto", "[CLASS:TBitBtn; INSTANCE:7]") = 1) Then
        If ControlClick("ISP Utility", "", "[CLASS:TBitBtn; INSTANCE:1]") And ControlClick("MStar ISP Utility", "", "[CLASS:TPanel; INSTANCE:1]") Then
;If (ControlClick("ISP Utility", "Run", "[CLASS:TBitBtn; INSTANCE:11]") = 1) Then
;MsgBox(0, "", "Success")
            If WinWait("Dialog", "", 5) = 0 Then Exit(1)
            $dialog_text = ControlGetText("Dialog", "", "[CLASS:Static; INSTANCE:2]")
            If @error = 1 Then
                MsgBox(0, "", "get dialog text failed")
                Exit(2)
            Else
                MsgBox(0, "Dialog", "Text = " & $dialog_text)
            EndIf
        Else
            MsgBox(0, "", "Failed")
        EndIf
    Else
        MsgBox(0, "", "Click auto Failed")
    EndIf
    
Else
    MsgBox(0, "Error", "ISP tool not activated")
EndIf
I can't see from the script you posted how you know it's the TPanel1 that's causing the problem. Why is the window title different for the TPanel ControlClick?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I can't see from the script you posted how you know it's the TPanel1 that's causing the problem. Why is the window title different for the TPanel ControlClick?

It's a typo. The window title is "ISP Utility" too.

I'm sure that ControlClick("ISP Utility", "", "[CLASS:TPanel; INSTANCE:1]") does not work in the following codes.

"ISP Utility exists"

"Click Auto OK"

"Click disconnect OK"

"Click connect OK"

All these 4 message box shows up. And the auto, disconnect button is clicked correctly.

That is,

ControlClick("ISP Utility", "Auto", "[CLASS:TBitBtn; INSTANCE:7]")
ControlClick("ISP Utility", "", "[CLASS:TBitBtn; INSTANCE:1]")

work fine.

Although "Click connect OK" pops up, but that button is not clicked correctly.

If that button is clicked correctly, there will be a pop-up message box shown by the "ISP Utility" program. But I did not see any pop up message box.

Any suggestions?

Thank you

AutoItSetOption("WinTitleMatchMode", 2)

If WinExists("ISP Utility") = 1 Then
    MsgBox(0, "", "ISP Utility exists") 
    If (ControlClick("ISP Utility", "Auto", "[CLASS:TBitBtn; INSTANCE:7]") = 1) Then
        MsgBox(0, "", "Click Auto OK")
        If ControlClick("ISP Utility", "", "[CLASS:TBitBtn; INSTANCE:1]") Then
            MsgBox(0, "", "Click disconnet OK")
            If ControlClick("ISP Utility", "", "[CLASS:TPanel; INSTANCE:1]") Then
                MsgBox(0, "", "Click connect OK")
            Else    
                MsgBox(0, "", "Click connect failed")
            EndIf
        Else
            MsgBox(0, "", "Click disconnet failed")
        EndIf
    Else
        MsgBox(0, "", "Click auto Failed")
    EndIf
    
Else
    MsgBox(0, "Error", "ISP tool not activated")
EndIf

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