Jump to content

Recommended Posts

Posted

Hello,

I can't figure out how to click on a plain button + minimize button in a Delphi application.

;~ >>>> Window <<<<
;~ Title:    AppMainForm
;~ Class:    TAppMainForm
;~ Position:    187, 67
;~ Size:    1010, 797
;~ >>>> Control <<<<
;~ Text:    Click
;~ Advanced (Class):    [CLASS:TAdvSmoothButton; INSTANCE:2]
;~ Position:    702, 651
;~ Size:    89, 27
;~ ControlClick Coords:    41, 10
;~ >>>> Mouse <<<<
;~ Position:    930, 728
;~ >>>> Control <<<<
;~ Text:    
;~ Advanced (Class):    [CLASS:TAdvShapeButton; INSTANCE:7]
;~ Position:    860, 60
;~ Size:    33, 29
;~ ControlClick Coords:    18, 13
;~ Style:    0x54000000
;~ ExStyle:    0x00000000
;~ Handle:    0x0001041C
;~ >>>> Mouse <<<<
;~ Position:    1065, 140

Const $APP = "APP.exe"
Const $APP_TITLE= "My App"
Const $APP_WINDOW = "[TITLE:AppMainForm;CLASS:TAppMainForm]"

If not ControlClick($APP_WINDOW,"","Click") Then
    ConsoleWrite("Button not found" & @CRLF)
EndIf
;ControlClick($APP_WINDOW,"","Click","left",1,50, 15)
;ControlClick($APP_WINDOW,"","[CLASS:TAdvSmoothButton; INSTANCE:2]")
;ControlClick Coords:    41, 10
ControlClick($APP_WINDOW,"","[CLASS:TAdvSmoothButton;INSTANCE:2]",1,41,10)
Sleep(2000)

;TODO Doesn't minimize
;WinSetState ($APP_WINDOW, "", @SW_MINIMIZE)
;ControlClick($APP_WINDOW,"","[CLASS:TAdvShapeButton; INSTANCE:7]")
;ControlClick($APP_WINDOW,"","[CLASS:TAdvShapeButton; INSTANCE:7]","left",1,15, 20)
ControlClick($APP_WINDOW,"","[CLASS:TAdvShapeButton;INSTANCE:7]","left",1,18, 13)

Any idea what else I could try?

Thank you.

Posted

1. I highly suggest you double-check your param in ControlClick statements.
Is the control id on this line actually "Click"?

 ControlClick($APP_WINDOW,"","Click")

The last three/four params are confusing. Are you trying to use left click, click 41 times, on the x offset = 10?

ControlClick($APP_WINDOW,"","[CLASS:TAdvSmoothButton;INSTANCE:2]",1,41,10)
ControlClick($APP_WINDOW,"","[CLASS:TAdvShapeButton;INSTANCE:7]","left",1,18, 13)


2. If it still doesn't work, go back and consider checking for window presence and activate it before any ControlClick statements.

Additionally, using Tidy (which is CTRL + T in SciTE) and removing commented lines before posting would be easier for others to skim through the code.

  • 2 weeks later...

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
×
×
  • Create New...