zbigdogz Posted July 18, 2021 Share Posted July 18, 2021 (edited) I'm not able to send any keystroke to the game from a C# program. I've tried many different methods. The game just doesn't recognize them. I've used SendKeys, Keyb_event, and Input Simulator and none of them are recognized by Skyrim but they are by other games/programs.I've also tried, with SendKeys. to send them directly to the Skyrim Window and still got nothing.Does anyone have an idea what I'm doing wrong? I have another program, GlovePie, that sends keystrokes to Skyrim successfully, which has added to my confusion more. Voice Macro also does it just fine, so I assume it's something I'm doing wrong. Here are the different C# codes I've tried (I have a mod that checks if Backslash is pressed down every second and, as i said before, GlovePie has no problem with holding down the slash key to be detected) 1.) SendKeys.SendWait("{\\}"); //Looped every 1 ms for 1 second 2.) keybd_event((byte)Key.BACKSLASH, (int)Key.DOWN, 0, 0); //Key.DOWN is pressing the key down Wait 1s keybd_event((byte)Key.BACKSLASH, (int)Key.UP, 0, 0); //Key.UP is releasing the keyI know the code is correct because it works for other program but maybe I need something extra for it to send to Skyrim? Edited July 18, 2021 by zbigdogz Link to comment Share on other sites More sharing options...
NexusComa2 Posted July 19, 2021 Share Posted July 19, 2021 Autohotkey / .au3 / Autoit ... work well for this kind of stuff. Link to comment Share on other sites More sharing options...
zbigdogz Posted July 26, 2021 Author Share Posted July 26, 2021 (edited) I'm trying to avoid having any dependencies other than SKSE. Edited July 26, 2021 by zbigdogz Link to comment Share on other sites More sharing options...
dylbill Posted July 28, 2021 Share Posted July 28, 2021 What specifically are you trying to do? Why do you need an external program? With SKSE you can detect key presses just fine. Event OnInit() RegisterforKey(42) ;left shift RegisterforKey(29) ;left control Endevent Event OnKeyDown(Int keyCode) If keyCode == 42 Debug.Notification("Left Shift Pressed") Elseif keyCode == 29 Debug.Notification("Left control Pressed") Endif EndEventhttps://www.creationkit.com/index.php?title=Input_Scripthttps://www.creationkit.com/index.php?title=OnKeyDown_-_Form Link to comment Share on other sites More sharing options...
Sphered Posted July 30, 2021 Share Posted July 30, 2021 He's looking to simulate input, and yeah I'm sure a DLL could be whipped up to enable this, or perhaps a mod I am unaware of already has done this, but in the meantime autohotkey doesnt need to be installed, and can just run with the game to do whatever you want. Takes something off SKSEs plate anyway so no reason not to other than just arbitrary preference Link to comment Share on other sites More sharing options...
Recommended Posts