2

I want to be able to execute a command in the currently visible conemu console from another process. Specifically i want to dispatch my build command from a gvim instance started from inside this ConEmu console (so it has various variables set by ConEmu like ConEmuHWND etc... that i think are the key to the solution).

So far i've been close with this one:

!start ConEmuC.exe /ATTACH /GHWND=<ConEmuHwnd from env var here> /C <my build command>

Which opens adds a new tab in my ConEmu window and executes the command given. Is some thing like this possible?

Fr0stBit
  • 1,455
  • 1
  • 13
  • 22

1 Answers1

2

How do you imagine that? Well, ConEmu starts new process when your shell is inside interactive loop, and what would happen? Both would read console, process console events (like CtrlC) and have a lot of race conditions. That's why it's not implemented in ConEmu.

Most proper way - is starting new tab, what you have already done.

There is another way - paste the command into the shell prompt with GuiMacro Paste. You even may execute it automatically by appending \n to the command. Of course, this method will fail if you shell (active tab) is not inside interactive cycle.

Maximus
  • 10,751
  • 8
  • 47
  • 65
  • 1
    I just happened to find out some really convinient macros on this and i am now achieving my goal using this kind of line: `ConEmuC /GUIMACRO: Print ""; Keys "{Enter}"` I also use a secondary macro for new console spawns in the form of: `Shell "new_console:sH" "" ` Thanks for this amazing product, and keep doing great job! – Fr0stBit Apr 08 '16 at 23:39