Reputation:
I'm trying to make a script in AutoHotkey where, when I press Numpad 1, it presses the slash button, then pastes in some text, let's say "hello world", and then presses enter, but I can't figure out how. Can someone help?
Upvotes: 2
Views: 4768
Reputation: 191
Assuming that you already have some text copied inside your clipboard before pressing the numpad1, the following code will work.
Numpad1::
Send, /^v ; ^ means ctrl key,
Send, {Enter}
return
Upvotes: 0
Reputation: 6489
Welcome to Stack Overflow.
In the future, try to at least show what you tried. All of this should be accomplished pretty easily by e.g. looking at the beginner tutorial combined with a quick Google search.
But well, here it is:
Numpad1::
Clipboard := "/hello word"
SendInput, ^v{Enter}
return
Numpad1::
creates the hotkey label.
Clipboard
:= ...
puts something into the clipboard.
SendInput
sends input.
^v
means Ctrl+v
.
{Enter}
means the enter key (could've possibly appended `n
(line feed) into the string as well).
Return
stops the hotkey label's code execution (in other words, ends the hotkey's code).
Upvotes: 2