0 votes

Hello,

I´m working on support application for a diffrent game and I need to simulate keyboard press. I know I can simulate keypress inside of application, but I´m looking for something like SendKeys Class.

Is it possible?

Thanks

Godot version 3.2.3.
in Engine by (17 points)

AFAIK it is not possible without a plugin and AFAIK there is no plugin for that yet.
What are you trying to do? Maybe there is another way.

Thanks for reply!

It should be the dashboard app for ETS 2. One part is an Android app that recieving telemetry via plugin and draw it to the cluster. Second part is server on PC that provide communication between app and game. So one way (from game to android) is working fine. But I want to made it the other way too, so when you press a button on android, it should call the keypress on PC.

Maybe you could hack something with OS.execute and a python-script with pyautogui.

2 Answers

+1 vote
Best answer

Godot is a game engine and not a windows manager or macro tool so it'll be very demanding to expect such functionalities from it out of the box.

On windows it would be better to use AutoHotkey for something like this but if you insist on using Godot the same can be achieved using vbScripts with cscrip.exe and OS.execute

Since csript is part of the global path you should be able to use it without defining it's absolute path

by (4,076 points)
selected by
–1 vote

Input.action_press() function might help you.

https://docs.godotengine.org/ja/stable/classes/class_input.html#class-input-method-action-press
For example, this simulates space-key input

Input.action_press("ui_accept")

You also should check Input.parseinputevent() function.

https://docs.godotengine.org/ja/stable/classes/class_input.html#class-input-method-parse-input-event

by (12 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.