I have a simple problem, yet it doesn't seem to have a simple solution.
Basically, I just want to use MouseMove using variables like so:
MouseMove, CoordX, CoordY
But it simply doesn't do anything, no error level change, no move. I verified that the variables were correctly assigned beforehand (to CoordX = 260 and CoordY = 1025). Hopefully it's something simple because I'm tired
MouseMove Simple Problem
Re: MouseMove Simple Problem
Use %% aruond your variable
Code: Select all
#Persistent
CoordX = 260
CoordY = 1025
w:: ; press w to move
MouseMove, %CoordX%, %CoordY%
return
Re: MouseMove Simple Problem
for me this also works:
Code: Select all
CoordX = 260
CoordY = 1025
w:: ; press w to move
MouseMove, CoordX, CoordY
Return
Re: MouseMove Simple Problem
@wolf_II:
Interesting , why does that work?
Interesting , why does that work?
Re: MouseMove Simple Problem
https://autohotkey.com/docs/commands/MouseMove.htm
When there is not mentioning of "may" be expression, you can still "force" it to accept expressions by putting a % and a whitespace character. I'm sure you have done that.
When a parameter CAN NOT accept an expression (voluntarily or otherwise), this is also documented.
Finally, when you want to pass a parameter to a command in command-style, you use %s around variables, like in good old MSDOS batch.
Whenever a command is able to accept function-style syntax, you will find the phrase "which can be expressions" in the documentation. Note that this applies to only the parameter where it is mentioned. MouseMove has a last parameter called "R", and although all preceeding parameters may be expressions, the final one may not.docs wrote:The x/y coordinates to move the mouse to, which can be expressions.
When there is not mentioning of "may" be expression, you can still "force" it to accept expressions by putting a % and a whitespace character. I'm sure you have done that.
When a parameter CAN NOT accept an expression (voluntarily or otherwise), this is also documented.
Finally, when you want to pass a parameter to a command in command-style, you use %s around variables, like in good old MSDOS batch.
Last edited by wolf_II on 24 Aug 2017, 02:01, edited 1 time in total.
- Delta Pythagorean
- Posts: 627
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: MouseMove Simple Problem
That's interesting. I didn't know that previously. Well, thanks for sharing!wolf_II wrote: [...]
Whenever a command is able to accept function-style syntax, you will find the phrase "which can be expressions" in the documentation.
[...]
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
Who is online
Users browsing this forum: downstairs, xrocket and 281 guests