Is it possible to click somewhere within a certain range? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
TheTerrarianBrony
Posts: 2
Joined: 13 Jun 2020, 10:07

Is it possible to click somewhere within a certain range?

13 Jun 2020, 10:18

Hi, I just started using ahk today and I'm catching on very quickly, but there's something I just can't figure out. Is it even possible to click somewhere random within a certain range? Thanks!
User avatar
Yakshongas
Posts: 590
Joined: 21 Jan 2020, 08:41

Re: Is it possible to click somewhere within a certain range?  Topic is solved

13 Jun 2020, 10:46

Here is a way to do it:

Code: Select all

F1::
    MouseMove, RandomPos1(1,100), RandomPos2(1,150)
    Click
Return

RandomPos1(MinX, MaxX)
{
    Random, ClickX, MinX, MaxX
    Return ClickX
}
RandomPos2(MinY, MaxY)
{
    Random, ClickY, MinY, MaxY
    Return CLickY
}
Please mark your topics as solved if you don't need any further help. ✅

Need a little more help? Discord : Yakshongas#9893 🕹
User avatar
boiler
Posts: 16923
Joined: 21 Dec 2014, 02:44

Re: Is it possible to click somewhere within a certain range?

14 May 2021, 10:09

There isn’t a reason for two different functions that are identical other than their internal variable names, which don’t make any functional difference. Could (and should) just be this:

Code: Select all

F1::
    MouseMove, Random(1,100), Random(1,150)
    Click
Return

Random(Min, Max)
{
    Random, Num, Min, Max
    Return Num
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: aitaixy, Anput, dangoscrub, joedf, Nerafius and 155 guests