How to Freeze Random Cordinates for X Axis

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
friedeggs911
Posts: 2
Joined: 19 Sep 2017, 06:49

How to Freeze Random Cordinates for X Axis

Post by friedeggs911 » 05 Jun 2023, 09:44

Hi there , thank you so much for this tool it helped me a lot
i have this small question :idea:

How to Freeze Random Cordinates for Y Axis and not for X Axis

so i have this Icon on my Desktop and its recognized by the mage search and moves the mouse button to the middle of it
using the Variables in the mouse Setting
%FoundX% and %FoundY% then
Check Random Coordinates CheckBox and set pixels but it works for Both X and Y
and i wanted to freeze the Y Axis and make the X Axis move randomly in a straight line

Thank you guys :wave: i really appreciate the whole Thing :thumbup:


[Mod action: Moved topic to v1 section because the syntax described is v1 syntax.]

User avatar
RaptorX
Posts: 372
Joined: 06 Dec 2014, 14:27
Contact:

Re: How to Freeze Random Cordinates for X Axis

Post by RaptorX » 06 Jun 2023, 12:26

Simply capture the current mouse position and use the current mouse pos for moving the mouse:

Code: Select all


F1::
; image search code here saving positions to imgX and imgY
; ...

; this would move the mouse only on the X axis to the position where the image X location was found
; but keep the Y position of where the mouse was located at that point in time
MouseGetPos, MouseX, MouseY
MouseMove, %imgX%, %MouseY%
return
Projects:
AHK-ToolKit

friedeggs911
Posts: 2
Joined: 19 Sep 2017, 06:49

Re: How to Freeze Random Cordinates for X Axis

Post by friedeggs911 » 07 Jun 2023, 02:13

image.png
image.png (7.96 KiB) Viewed 558 times
Thank you so much for replying :)
actually it works :superhappy: but it leaves the Image and go above it by maybe 100 Pixels
besides i can't fine MouseMove in Commands just to do it Exactly as you mentioned :!:
image.png
image.png (7.93 KiB) Viewed 558 times

User avatar
RaptorX
Posts: 372
Joined: 06 Dec 2014, 14:27
Contact:

Re: How to Freeze Random Cordinates for X Axis

Post by RaptorX » 07 Jun 2023, 11:11

friedeggs911 wrote:
07 Jun 2023, 02:13
image.png
Thank you so much for replying :)
actually it works :superhappy: but it leaves the Image and go above it by maybe 100 Pixels
You can correct for that by adding to/subtracting from the variable like this:

Code: Select all

MouseGetPos, MouseX, MouseY
MouseY -= 100 ; subtract 100 pixels ➡ moves the mouse up by 100
; or MouseY += 100 ; add 100 pixels ➡ moves the mouse down

MouseMove, %imgX%, %MouseY%
you can do that with any numeric variable :)
friedeggs911 wrote:
07 Jun 2023, 02:13
besides i can't fine MouseMove in Commands just to do it Exactly as you mentioned :!:
image.png
I didnt know pulover's macro creator had a function finder hehe
but it seems like he hasnt updated the command list in a very long while or the search function is not returning the correct values.

I usually go to the documentations Alphabetical Command and Function Index when i want to know if a command is available or not.
Projects:
AHK-ToolKit

Post Reply

Return to “Ask for Help (v1)”