This seemed to me like it should be a pretty common and useful thing to a lot of people, so I'd be surprised if no one has a script already to do this...
I'm looking for a script to be able to assign certain spots on my screen, and assign a different hot key combination to each spot, to be able to have a click simulated on that spot when I press that hot key combination. I imagine I would click a button to tell the script I'm ready to assign a new spot, then I'll click on that new spot, then press the key or key combination I want to use as the trigger for it. Then every time I press that key combination after that, it will generate a click on that spot.
I looked a little at Pulover’s Macro Creator at https://www.macrocreator.com/ but that seems to just create a script, and doesn't automatically set up hotkeys for the places I click.
I want to be able to set up multiple places on screen to send clicks to by pressing different key combos.
Remember spots to send clicks to Topic is solved
Re: Remember spots to send clicks to Topic is solved
You're right. What did you find in your forum search?
Code: Select all
map := {}, width := 250
Gui, Font, s10
Gui, Add, Text , Center w%width% vcoord
Gui, Add, Text , xm , Hotkey:
Gui, Add, Hotkey, x+m yp-3 w190 vhk
Gui, Add, Button, xm w%width% Default, OK
F3::
CoordMode, Mouse
MouseGetPos, x, y
GuiControl,, coord, (%x%,%y%)
Gui, Show,, Clicks
Return
ButtonOK:
Gui, Submit
map[hk, "x"] := x, map[hk, "y"] := y
Hotkey, %hk%, Clik, On
Return
Clik:
CoordMode, Mouse
MouseClick,, map[A_ThisHotkey].x, map[A_ThisHotkey].y
Return
GuiEscape:
GuiClose:
Gui, Hide
Return
Re: Remember spots to send clicks to
@mikeyww
Didn't know you could skip declaring the nested object like this.
as opposed to something like this.
Thanks for sharing ![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Didn't know you could skip declaring the nested object like this.
Code: Select all
Map := {}
Map[ hk , "x" ] := SomeValue
Code: Select all
Map := {}
Map[ hk ] := { X: SomeValue }
![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Re: Remember spots to send clicks to
You are welcome. Reference: https://www.autohotkey.com/docs/Objects.htm#Usage_Arrays_of_Arrays
table[x][y] := content ; A
table[x, y] := content ; B
If table[x] does not exist, A fails whereas B automatically creates an object and stores it in table[x].
Re: Remember spots to send clicks to
Awesome sauce. I didn't find what I was looking for when I searched before. But this looks like what I was looking for. Kudos.mikeyww wrote: ↑07 Jan 2022, 14:36You're right. What did you find in your forum search?
Code: Select all
map := {}, width := 250 Gui, Font, s10 Gui, Add, Text , Center w%width% vcoord Gui, Add, Text , xm , Hotkey: Gui, Add, Hotkey, x+m yp-3 w190 vhk Gui, Add, Button, xm w%width% Default, OK F3:: CoordMode, Mouse MouseGetPos, x, y GuiControl,, coord, (%x%,%y%) Gui, Show,, Clicks Return ButtonOK: Gui, Submit map[hk, "x"] := x, map[hk, "y"] := y Hotkey, %hk%, Clik, On Return Clik: CoordMode, Mouse MouseClick,, map[A_ThisHotkey].x, map[A_ThisHotkey].y Return GuiEscape: GuiClose: Gui, Hide Return