Lua: imitate keystrokes

Although I guess I already know the answer, I post my question here:
Is it possible, to imitate keystrokes in Lua somehow?
I mean something like hitting the “Enter” or “Tab” keys on the keyboard via script.

No, but there should be no need to do that.

Everything that can be triggered by keyboard is an Action, and all Actions are directly accessible via Editor:access_action. Have a look at the exhaustive list: The Ardour Manual - List of Menu Actions

So instead of <Tab>, you can directly use
Editor:access_action("Common", "add-location-from-playhead")

PS. There is no workaround to sidestep user-interactive dialogs by sending fake key-events from within Ardour.

Thank you for your reply, Robin!
In fact, the Editor:access_action() is the reason for my question.
I want to remove a selected track with a script via Editor:access_action("Editor", "remove-track"), but wan’t to avoid to confirm the removal of the track in the following confirmation dialog. I thought, maybe there was a command, i can use in the script, which let me automatically confirm the dialog. :wink:
But yeah, I already foreseen that answer! :wink:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.