Autohotkey sometimes doesn't click, why?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

Autohotkey sometimes doesn't click, why?

Post by zerox » 29 Nov 2021, 00:45

Hello! I tried several codes, and i have the same problem with all, 10-20% (or more) no clicks. Can someone tell me what is the problem? for example in this code

Code: Select all

Pause
MsgBox Press Ok to start leveling up
loop {
Send b
Send {Click 1225 375}
Send {Click 1237 710}
Send {Click 1632 734}
Send {Shift down}
Send {Click 1010 620}
Sleep 200
Send {Click 960 620}
Sleep 200
Send {Click 910 620}
Sleep 200
Send {Click 910 570}
Sleep 200
Send {Shift up}
Send {Esc}
Send {Click 960 650}
Send {Click 960 650}
Send {Click 960 650}
Sleep 700
}
return

y::Pause 
[Mod edit: Codebox fixed.]

User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Autohotkey sometimes doesn't click, why?

Post by Xtra » 29 Nov 2021, 02:08

Read: CoordMode

You probably want it set to screen. (put at top of script)
CoordMode, Mouse, Screen

zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

Re: Autohotkey sometimes doesn't click, why?

Post by zerox » 29 Nov 2021, 15:03

Xtra wrote:
29 Nov 2021, 02:08
Read: CoordMode

You probably want it set to screen. (put at top of script)
CoordMode, Mouse, Screen
Coordmode is also bad, sometimes not clicking. I have this:

Code: Select all

Numpad1::
Send E
For each, coord in [[240, 660], [237, 735], [986, 330], [390, 734], [1105, 330], [300, 735], [1030, 330]] {
 move(coord.1, coord.2), DllCall("mouse_event", "UInt", LBDN := 2)
 Sleep, 70 ; Milliseconds after button down
 DllCall("mouse_event", "UInt", LBUP := 4)
 Sleep, 70 ; Milliseconds after button up
}
move(683, 380)
Return

move(x, y) { ; Coordinates relative to the active window
 Static SysX := 65535 / A_ScreenWidth, SysY := 65535 / A_ScreenHeight
 WinGetPos, winX, winY,,, A
 DllCall("mouse_event", "UInt", ABSMOVE := 32769, "UInt", (x + winX) * SysX, "UInt", (y + winY) * SysY)
}
[Mod edit: [code][/code] tags added.]
Last edited by gregster on 29 Nov 2021, 15:32, edited 1 time in total.
Reason: Please use code tags. Thank you!

Post Reply

Return to “Ask for Help (v1)”