How to use send key

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hieveryone
Posts: 43
Joined: 28 Nov 2022, 01:31

How to use send key

Post by hieveryone » 28 Nov 2022, 05:32

I've been searching for almost 24 hours and got nothing.


So what I want is when I press a key(let's say :a)
It will activate a script in the same file
Pretend this is the script: mousemove 50, 0 ,0 ,r;

So when I press a it should move my cursor
Similar to the if statement in js

I'm new so I don't really know, this is probably really simple

User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: How to use send key

Post by mikeyww » 28 Nov 2022, 07:26

Code: Select all

a::MouseMove, 50, 0, 0, R
Explained: Introduction and simple examples

hieveryone
Posts: 43
Joined: 28 Nov 2022, 01:31

Re: How to use send key

Post by hieveryone » 28 Nov 2022, 22:07

Hi thank you, how would we do with multiple lines of code thanks

User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: How to use send key

Post by boiler » 29 Nov 2022, 00:34

hieveryone wrote: I've been searching for almost 24 hours and got nothing.
Rather than searching the internet for 24 hours, you could have read about the fundamentals of AHK from the manual in a fraction of the time and have learned the answer to your question and much more by now.

hieveryone wrote: how would we do with multiple lines of code
That’s in this part of the manual, which is the exact link that mikeyww gave you.

hieveryone
Posts: 43
Joined: 28 Nov 2022, 01:31

Re: How to use send key

Post by hieveryone » 29 Nov 2022, 23:44

@boiler
no it isnt ive checked the thing and it doesnt say how to do lines.

User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: How to use send key

Post by boiler » 30 Nov 2022, 00:06

Yes it is. Check the thing more carefully:
Hotkeys Intro wrote:

Code: Select all

#n::
Run Notepad
return
In the final line above, return serves to finish the hotkey. However, if a hotkey needs to execute only a single line, that line can be listed to the right of the double-colon. In other words, the return is implicit:

Code: Select all

#n::Run Notepad
Hopefully, from where it goes on to say what you can do in the case of a single line, you can deduce that what was just shown is what you would use for multiple lines. To make it more explicit for you:

Code: Select all

#n::
Run Notepad
MsgBox, Hello!  I'm on another line!
return

hieveryone
Posts: 43
Joined: 28 Nov 2022, 01:31

Re: How to use send key

Post by hieveryone » 30 Nov 2022, 00:19

boiler wrote:
30 Nov 2022, 00:06
Yes it is. Check the thing more carefully:
Hotkeys Intro wrote:

Code: Select all

#n::
Run Notepad
return
In the final line above, return serves to finish the hotkey. However, if a hotkey needs to execute only a single line, that line can be listed to the right of the double-colon. In other words, the return is implicit:

Code: Select all

#n::Run Notepad
Hopefully, from where it goes on to say what you can do in the case of a single line, you can deduce that what was just shown is what you would use for multiple lines. To make it more explicit for you:

Code: Select all

#n::
Run Notepad
MsgBox, Hello!  I'm on another line!
return
sorry boiler, i am really dumb.could you explain what run notepad does?
does it run thewhole note pad? because i just want to run a specific function

hieveryone
Posts: 43
Joined: 28 Nov 2022, 01:31

Re: How to use send key

Post by hieveryone » 30 Nov 2022, 00:57

boiler wrote:
30 Nov 2022, 00:06
Yes it is. Check the thing more carefully:
Hotkeys Intro wrote:

Code: Select all

#n::
Run Notepad
return
In the final line above, return serves to finish the hotkey. However, if a hotkey needs to execute only a single line, that line can be listed to the right of the double-colon. In other words, the return is implicit:

Code: Select all

#n::Run Notepad
Hopefully, from where it goes on to say what you can do in the case of a single line, you can deduce that what was just shown is what you would use for multiple lines. To make it more explicit for you:

Code: Select all

#n::
Run Notepad
MsgBox, Hello!  I'm on another line!
return
wit nevermind it works ive figured it out, then the nswer to this should be f4irly e4sy 4s well: viewtopic.php?f=76&t=111011

Post Reply

Return to “Ask for Help (v1)”