Closed indiscible closed 2 months ago
Basically the feature I'm looking for is a way to inject commands into the console.
When? In response to what?
Maybe you're looking for clink.onprovideline()?
Maybe you're looking for rl.invokecommand() and accept-line
?
Or maybe for something else, depending on broader context about what you're trying to do.
I would like to send a (for example a compile & run) command (from emacs or clink?) to an existing cmd window as if I had entered it by hand. To replace a "Save, Alt-Tab, Up-Arrow, Enter" sequence.
Conceptually it's like writing to the stdin of another cmd process, if that makes sense.
clink.onprovideline() looks interesting (and dangerous), thanks !
It sounds like you want to send arbitrary keystrokes from one program/window (the active one...?) to another program/window (which is not the active window...?). If so, then that isn't related to Clink.
If you want to send keys to the active window, then you can explore SendKeys and similar things.
Sending keys to a non-active window is more difficult, and is unreliable depending on what keys you're trying to send (and in what language, etc). This stackoverflow post gives a quick introductory summary into the topic.
ok, thanks for the extra info, I'll keep digging....
I looked at the lua doc and the closest I found was rl_buffer.insert("dir") but then I cannot find a way to send the return as well...
Basically the feature I'm looking for is a way to inject commands into the console.