How to send keypress directly to other app?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

How to send keypress directly to other app?

21 Mar 2017, 17:10

Hi!

I want to use keystrokes in emulator, explaining:

Emulated keyboard is mapped to real keyboard, so key events are taken from real keyboard.

I want to use key combinations on not mapped keys - example:
- in emulator CTRL+E changes character color to white - this is mapped in emulator TAB+E > so it requires send TAB+E, in AHK I set Ins key - this is not problem, but emulator looks like no action.
- in emulator Esc and then X changes active desktop - this is mapped in emulator F1 then X > requires to send F1 keypress and then X keypress, in AHK I set Del - again - no action.
- I used key F9 as key which displays directory - it sends to emulator clipboard content in which is command DIR and <Enter> - this works...

I created little program in Visual Basic which simulates keypress - works, but like on background - like global shortcuts, not to specific app and teted it for emulator - again no action, global keys send correctly.
I need to use key direct send to any app.
I tried written above in AHK also when is emulator window focused, but no success.
Can anybody help me with direct key sending?

Thank you all for help.
Miro
CrescentSurfer
Posts: 10
Joined: 21 Mar 2017, 22:56

Re: How to send keypress directly to other app?

21 Mar 2017, 23:09

Try sending Key Up and Key down manually, for example, instead of this

Code: Select all

Send, Hello
try this:

Code: Select all

send {H down}
sleep 10
send {H up}
sleep 10

send {e down}
sleep 10
send {e up}
sleep 10

send {l down}
sleep 10
send {l up}
sleep 10

send {l down}
sleep 10
send {l up}
sleep 10

send {o down}
sleep 10
send {o up}
sleep 10
This method is required for the input to register in a lot of games, including emulators.
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: How to send keypress directly to other app?

22 Mar 2017, 08:44

Nice! Nice! Nice!
You helped me wih problem which I couldn't solve more than year ago!
Maybe you don't know how much you helped me - your help is in price of gold.

Thank you veeeery much!
Miro
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: How to send keypress directly to other app?

22 Mar 2017, 19:24

I created all what was really long time wanted.
But found bug(s)...
If I use keycombination with Shift it affects sending keys, also it looks it takes status of modifiers.

How to avoid - during sending keycominations - to affect them by modifiers (Shift, Ctrl, Win...)?
If is it possible, can be any modifier used in sending keys?

Thank you for help.
Miro
CrescentSurfer
Posts: 10
Joined: 21 Mar 2017, 22:56

Re: How to send keypress directly to other app?

22 Mar 2017, 20:01

Instead of Send command, try using SendInput. According to the help file: "they buffer any physical keyboard or mouse activity during the send, which prevents the user's keystrokes from being interspersed with those being sent."
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: How to send keypress directly to other app?

23 Mar 2017, 05:07

SendInput makes it even worse.

Miro
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: How to send keypress directly to other app?

23 Mar 2017, 12:23

Is possible to fix it?
Thank you all for each help.
Miro

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: just me, Rohwedder and 165 guests