Page 1 of 1

Multiple cordinates click on one hotkey.

Posted: 11 Sep 2018, 12:17
by linksmakotis
Hello. I'm begginer with hotkeys.
I'm looking to make script ,that clicks in multiple cordinates,by one click ..
For example, I press f1 ,and its click here 1292,372 here 1146,336 and here 1292,372 .
Thanks everyone for help !

Re: Multiple cordinates click on one hotkey.

Posted: 11 Sep 2018, 12:26
by TheDewd

Code: Select all

#SingleInstance, Force

arrCoord := []
arrCoord[1] := "1292,372"
arrCoord[2] := "1146,336"
arrCoord[3] := "1292,372"

F1::
	For K, V In arrCoord {
		C := InStr(V, ",")
		X := SubStr(V, 1, C - 1)
		Y := SubStr(V, C + 1)

		Click, X, Y
	}
return

Re: Multiple cordinates click on one hotkey.

Posted: 11 Sep 2018, 12:31
by swagfag

Code: Select all

CoordMode Mouse

Coords := [[1292, 372]
		 , [1146, 336]
		 , [1292, 372]]

F1::
	for each, Pair in Coords
	{
		x := Pair[1]
		y := Pair[2]
		Click, %x%, %y%
	}
return

Re: Multiple cordinates click on one hotkey.

Posted: 11 Sep 2018, 12:37
by TheDewd

Code: Select all

F1::
	Click, 1292, 372
	Click, 1146, 336
	Click, 1292, 372
return
:D

Re: Multiple cordinates click on one hotkey.

Posted: 12 Sep 2018, 18:54
by bordop
I wrote a little function that you might benefit from. It sends a click to the coordinates you specify as x and y and returns your mouse to the same location it was in when the code was executed.

Code: Select all

fn_click(x,y)
{
	CoordMode, mouse, Screen
	MouseGetPos, xpos, ypos
	Click, Left, %x%, %y%, 1
	MouseMove, %xpos%, %ypos%, 0
	Return
}

Your examples would look like this:

fn_click(1292, 372)
fn_click(1146, 336)
fn_click(1292, 372)