Having the Shift key pressed while pressing other button.

Get help with using AutoHotkey and its commands and hotkeys
Straut
Posts: 11
Joined: 22 May 2018, 02:49

Having the Shift key pressed while pressing other button.

22 May 2018, 02:57

Hi!

I couldn't find any help while searching so I figure I have to make my own post.

While writing a script I need to have the shift-key being pressed down and while shift is pressed button D must be pressed. So, basicly I need Shift+d to be pressed but Shift must be pressed before the D button. Don't ask me why but the system doesn't work iif the are pressed at the same time.

Does anyone know how to make this work?

Please help me!
OCP
Posts: 83
Joined: 28 Mar 2018, 19:28

Re: Having the Shift key pressed while pressing other button.

22 May 2018, 02:59

send, {Shift Down}
Send, d
Send, {Shift Up}

perhaps
Straut
Posts: 11
Joined: 22 May 2018, 02:49

Re: Having the Shift key pressed while pressing other button.

22 May 2018, 03:19

Tried it but it won't work. :( Any other idea?
OCP
Posts: 83
Joined: 28 Mar 2018, 19:28

Re: Having the Shift key pressed while pressing other button.

22 May 2018, 03:34

works for me, does it need to be on a active window or so? perhaps first activate that window before you send this

if i use the keyboard hook i can see it works see attachment
Attachments
2.jpg
2.jpg (109.51 KiB) Not viewed yet
Straut
Posts: 11
Joined: 22 May 2018, 02:49

Re: Having the Shift key pressed while pressing other button.

22 May 2018, 08:40

Ahh... I see that it works but there must be some kind of problem with the program that I'm running it in. Hmm.... Thanks for the help though.
OCP
Posts: 83
Joined: 28 Mar 2018, 19:28

Re: Having the Shift key pressed while pressing other button.

22 May 2018, 08:48

Ahh... I see that it works but there must be some kind of problem with the program that I'm running it in. Hmm.... Thanks for the help though.
try to put something like this before the shift d stuff

Code: Select all

	IfWinExist, ahk_class yourwindowname 
	WinActivate
there is other ways to do the same i am also learning but this is how i ensure that window gets it
Straut
Posts: 11
Joined: 22 May 2018, 02:49

Re: Having the Shift key pressed while pressing other button.

22 May 2018, 09:41

Yes, I've included those lines and the whole script runs perfectly until those lines. Just noticed that I had to add a loop for it to work. Dunno why though. But it works. :)
OCP
Posts: 83
Joined: 28 Mar 2018, 19:28

Re: Having the Shift key pressed while pressing other button.

22 May 2018, 09:46

nice glad i could help

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 60 guests