Multiple cordinates click on one hotkey.

Get help with using AutoHotkey and its commands and hotkeys
linksmakotis
Posts: 1
Joined: 11 Sep 2018, 12:11

Multiple cordinates click on one hotkey.

11 Sep 2018, 12:17

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 !
User avatar
TheDewd
Posts: 1414
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Multiple cordinates click on one hotkey.

11 Sep 2018, 12:26

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
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.
swagfag
Posts: 4025
Joined: 11 Jan 2017, 17:59

Re: Multiple cordinates click on one hotkey.

11 Sep 2018, 12:31

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
User avatar
TheDewd
Posts: 1414
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Multiple cordinates click on one hotkey.

11 Sep 2018, 12:37

Code: Select all

F1::
	Click, 1292, 372
	Click, 1146, 336
	Click, 1292, 372
return
:D
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.
bordop
Posts: 10
Joined: 03 Jun 2018, 23:03
GitHub: bordop

Re: Multiple cordinates click on one hotkey.

12 Sep 2018, 18:54

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)

Return to “Ask For Help”

Who is online

Users browsing this forum: btonasse, bushez, cheatH12, Visioneer and 50 guests