Script to do a series of key inputs?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fender967
Posts: 14
Joined: 08 Dec 2016, 10:30

Script to do a series of key inputs?

09 Dec 2016, 15:45

I'm trying to get it so that when I press Shift+w windows reacts as if i have pressed:

Ctrl+r
down arrow key 5 times
enter

I can't figure out which operators to use.
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: Script to do a series of key inputs?

09 Dec 2016, 16:14

Code: Select all

$+w::			; registers Shift+w hotkey ($  forces keyboard hook)
Send, ^r		; sends Ctrl+r
Send, {Down 5}	; sends down arrow key 5 times
Send, {Enter}	; sends enter
return			; finishes hotkey subrputine
fender967
Posts: 14
Joined: 08 Dec 2016, 10:30

Re: Script to do a series of key inputs?

09 Dec 2016, 16:37

Learning one wrote:

Code: Select all

$+w::			; registers Shift+w hotkey ($  forces keyboard hook)
Send, ^r		; sends Ctrl+r
Send, {Down 5}	; sends down arrow key 5 times
Send, {Enter}	; sends enter
return			; finishes hotkey subrputine
Is there any way to do this only when in a specific program?
dccostac
Posts: 24
Joined: 21 Jul 2016, 14:04

Re: Script to do a series of key inputs?

09 Dec 2016, 17:23

#IfWinActive, Notepad
$+w:: ; registers Shift+w hotkey ($ forces keyboard hook)
Send, ^r ; sends Ctrl+r
Send, {Down 5} ; sends down arrow key 5 times
Send, {Enter} ; sends enter
return ; finishes hotkey subrputine


Just add "#IfWinActive, WindowName" at the beginning.
fender967
Posts: 14
Joined: 08 Dec 2016, 10:30

Re: Script to do a series of key inputs?

12 Dec 2016, 10:21

dccostac wrote:#IfWinActive, Notepad
$+w:: ; registers Shift+w hotkey ($ forces keyboard hook)
Send, ^r ; sends Ctrl+r
Send, {Down 5} ; sends down arrow key 5 times
Send, {Enter} ; sends enter
return ; finishes hotkey subrputine


Just add "#IfWinActive, WindowName" at the beginning.
I see, but what if the window name in the program changes depending on the file that is open? This is how it works in Adobe Bridge, which is what I'm trying to use it in.
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: Script to do a series of key inputs?

14 Dec 2016, 01:56

Then use Window Class. For example: #IfWinActive ahk_class Notepad

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], TAC109 and 258 guests