Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Simulate Keyboard Press  (Read 652 times)

0 Members and 1 Guest are viewing this topic.

stevemartin92

  • Newbie
  • *
  • Posts: 1
    • View Profile
Simulate Keyboard Press
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: Simulate Keyboard Press
« Reply #1 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/
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything