SFML community forums

Help => General => Topic started by: stevemartin92 on June 10, 2022, 05:12:35 pm

Title: Simulate Keyboard Press
Post by: stevemartin92 on June 10, 2022, 05:12:35 pm
Hello, I'm looking to be able to write code that enters a keyboard press. I've had success being able to manipulate the position of the mouse using sf::Mouse::setPosition() and now I would like to do the same with the keyboard.

For example... Let's say that once a second I want the code to send a key press of A. So that if my cursor is in a text box... the code can type in the key A 'on its own'.

How can I do this?
Title: Re: Simulate Keyboard Press
Post by: eXpl0it3r on June 10, 2022, 05:23:36 pm
SFML doesn't support this. If you want to automate things like that, you're better served with something like AutoHotkey: https://www.autohotkey.com/