how to properly fill the control click coords?

Ask gaming related questions (AHK v1.1 and older)
ravena1
Posts: 62
Joined: 06 Sep 2017, 15:13

how to properly fill the control click coords?

25 Mar 2022, 08:47

i wanna make the script works even inactive/background and click the stop button in the app... as you can see im using the coord client from ahk window spy, but its not clicking it,

how do i fill the x and y coords correctly? do i need to use client coord from ahk window spy?


Code: Select all

SetTitleMatchMode RegEx
mywinclass:="14488"


home::
WinGet, AhkPID, PID, A
WinGetClass, mywinclass, ahk_pid %AhkPID%
SplashTextOn,,, PID:%AhkPID% ACTIVATED
Sleep 2000
SplashTextOff

sleep 500
ControlClick, x148 y587, ahk_pid %AhkPID%, , Left, 1, NA
Image
Last edited by ravena1 on 25 Mar 2022, 09:09, edited 3 times in total.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: how to properly fill the control click coords?

25 Mar 2022, 08:52

do i need to use client coord from ahk window spy?
Why not trying it? There's even mentioned "(recommended)", so…?? :think:
ravena1
Posts: 62
Joined: 06 Sep 2017, 15:13

Re: how to properly fill the control click coords?

25 Mar 2022, 08:59

BoBo wrote:
25 Mar 2022, 08:52
do i need to use client coord from ahk window spy?
Why not trying it? There's even mentioned "(recommended)", so…?? :think:
as you can see im using the coord shown in ahk window spy, but it is not clicking the button so i assume the coords is incorrect or did i missed something?
User avatar
boiler
Posts: 17206
Joined: 21 Dec 2014, 02:44

Re: how to properly fill the control click coords?

25 Mar 2022, 12:59

BoBo wrote:
do i need to use client coord from ahk window spy?
Why not trying it? There's even mentioned "(recommended)", so…?? :think:
It means "recommended" when you have a choice for setting the CoordMode. Those are not to be used for ControlClick, which uses Window coordinates. In some cases, Client coordinates and Window coordinates may align so it happens to work to use them, but that would just be by coincidence. As stated in the documentation:
ControlClick documentation wrote:Specify the X and Y coordinates relative to the target window's upper left corner.
The upper left corner of a window is not where the client area of a window begins unless it happens to have no caption bar and border.
User avatar
boiler
Posts: 17206
Joined: 21 Dec 2014, 02:44

Re: how to properly fill the control click coords?

25 Mar 2022, 13:02

ravena1 wrote: as you can see im using the coord shown in ahk window spy, but it is not clicking the button so i assume the coords is incorrect or did i missed something?
In your window's case, the client area may be the same as the whole window, so using Client coordinates may be OK, but not every window responds to ControlClick.
ravena1
Posts: 62
Joined: 06 Sep 2017, 15:13

Re: how to properly fill the control click coords?

25 Mar 2022, 14:53

any idea how to find the coord of button? its driving me nuts
User avatar
boiler
Posts: 17206
Joined: 21 Dec 2014, 02:44

Re: how to properly fill the control click coords?

25 Mar 2022, 14:59

Actually, I can see even though you have mostly covered up the Window coordinates with your red line that they are different than the Client coordinates, so you are using the wrong coordinates. Use what it shows for Window coordinates. As I pointed out above, ControlClick uses Window coordinates, not Client, so on windows where they are not the same, which is most of them, do not use Client coordinates with ControlClick. Since you should be clicking about 30 pixels lower, it appears you missed the button by clicking just above it.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 28 guests