Asking for a huge help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cocoloco
Posts: 7
Joined: 02 Apr 2020, 05:26

Asking for a huge help

02 Apr 2020, 05:41

Hey, I want to make script that would do:

• HOLDS Alt, and presses with Mouse left click on certain location random between x and y (I put the picture to make it clear what I want) which I would set
Untitled-1.png
Untitled-1.png (1.46 KiB) Viewed 550 times
I want that I would press for example G:: and it would hold Alt while pressing on the box random location, just inside what parameters I give.

Maybe anyone haves already done it something similar and could share?
Barney15
Posts: 168
Joined: 12 Jan 2020, 14:18

Re: Asking for a huge help

02 Apr 2020, 15:32

Code: Select all

MouseGetPos, xpos, ypos
ToolTip, % "X : " . xpos . "`nY : " ypos
F2::Reload   ;To choose the coordinates Max and Min
F1::             ;Lunch the script
Random, X, Max, Min ;Replace the Max and Min Found values eg : Random, X, 100, 500
Random, Y, Max, Min
MouseMove, %X%, %Y%, 100
Sleep,10
Send, !{Click ,%X%, %Y%}
return
see if this works for you.
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Asking for a huge help

02 Apr 2020, 15:37

Perhaps this?

Code: Select all

#SingleInstance, Force
Coordmode, Mouse, Window  ;Change as needed.
Positions := [{X1:0,Y1:300,X2:30,Y2:350},{X1:60,Y1:300,X2:90,Y2:350},{X1:120,Y1:300,X2:150,Y2:350},{X1:180,Y1:300,X2:210,Y2:350}] ;Change positions as needed.
return
Ran(Min,Max){
	Random,Out,Min,Max
	return Out
}
g::
	Send, {Alt Down}
	MouseClick,,Ran(Positions[out:=Ran(1,4)].X1,Positions[out].X2),Ran(Positions[out].Y1,Positions[out].Y2)
	Send, {Alt Up}
	return
*ESC::ExitApp
cocoloco
Posts: 7
Joined: 02 Apr 2020, 05:26

Re: Asking for a huge help

03 Apr 2020, 08:13

Hellbent wrote:
02 Apr 2020, 15:37
Perhaps this?

Code: Select all

#SingleInstance, Force
Coordmode, Mouse, Window  ;Change as needed.
Positions := [{X1:0,Y1:300,X2:30,Y2:350},{X1:60,Y1:300,X2:90,Y2:350},{X1:120,Y1:300,X2:150,Y2:350},{X1:180,Y1:300,X2:210,Y2:350}] ;Change positions as needed.
return
Ran(Min,Max){
	Random,Out,Min,Max
	return Out
}
g::
	Send, {Alt Down}
	MouseClick,,Ran(Positions[out:=Ran(1,4)].X1,Positions[out].X2),Ran(Positions[out].Y1,Positions[out].Y2)
	Send, {Alt Up}
	return
*ESC::ExitApp
Thanks first of all, I edited something wrong or the script is not what I asked, I don't want to random click on those boxes I want that random would be the click inside the box, everytime I would execute, everytime it would be random position where it would click, just inside that box
xq.png
xq.png (2.38 KiB) Viewed 436 times
I put an example, also I want a loop that would execute click on one box random inside somewhere in that square, another, third and would stop.

Thanks for help, im trying to also edit some scripts but I can't make it..
cocoloco
Posts: 7
Joined: 02 Apr 2020, 05:26

Re: Asking for a huge help

03 Apr 2020, 08:27

Barney15 wrote:
02 Apr 2020, 15:32

Code: Select all

MouseGetPos, xpos, ypos
ToolTip, % "X : " . xpos . "`nY : " ypos
F2::Reload   ;To choose the coordinates Max and Min
F1::             ;Lunch the script
Random, X, Max, Min ;Replace the Max and Min Found values eg : Random, X, 100, 500
Random, Y, Max, Min
MouseMove, %X%, %Y%, 100
Sleep,10
Send, !{Click ,%X%, %Y%}
return
see if this works for you.

this one seems works, what I just need how can I add three more rows and loop it ?
Barney15
Posts: 168
Joined: 12 Jan 2020, 14:18

Re: Asking for a huge help

03 Apr 2020, 09:14

Code: Select all

MouseGetPos, xpos, ypos
ToolTip, % "X : " . xpos . "`nY : " ypos
F2::Reload   ;To choose the coordinates Max and Min
F1::             ;Lunch the script
Loop, 3  ; repeat this 3 times
{
Random, X, Max, Min ;Replace the Max and Min Found values eg : Random, X, 100, 500
Random, Y, Max, Min
MouseMove, %X%, %Y%, 100
Sleep,10
Send, !{Click ,%X%, %Y%}
}
return
in this loop it will creat new X and Y each time it loops
if you want them to be constant move Random x and Y out of the loop.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 348 guests