ConEmu / old-issues

Old issues for ConEmu project (import is pending)
http://conemu.github.io/
0 stars 1 forks source link

Launch external programs using current path as argument !? #1126

Closed ConEmu closed 9 years ago

ConEmu commented 9 years ago

From pfeif...@tzi.de on June 27, 2013 03:57:33

Required information! OS version: Windows 7 Ultimate, 64 bit, SP1, German ConEmu version: ConEmu 130625 [64]

I'm wondering if it is possible to launch an external program by a hotkey that uses the current path of the active cmd.exe as program argument.

Such a feature would allow the user to press CTRL-O to open the current path of cmd.exe in DirectoryOpus or anything similar.

PS: Obviously the launched program should not be docked.

Original issue: http://code.google.com/p/conemu-maximus5/issues/detail?id=1127

ConEmu commented 9 years ago

From ConEmu.M...@gmail.com on June 27, 2013 04:04:38

Not sure, what do you want. For example, type in cmd prompt

Explorer %CD%

Of course, you may use GuiMacro print("\eExplorer %CD%\n")

ConEmu commented 9 years ago

From pfeif...@tzi.de on June 27, 2013 04:15:00

That's nice, thanks for the hint.

Is it possible to directly launch a program using a GuiMacro and passing %CD% even if the current cmd.exe is busy within a batch file?

The print() solution needs an non-busy console but if the console is busy (e.g. a running maven build) it would be nice if I can launch an external program anyway.

Is that possible too?

ConEmu commented 9 years ago

From ConEmu.M...@gmail.com on June 27, 2013 04:18:47

If your console is busy - working for its undetermined. And of course, print will not work.

But you may "Duplicate root" and "print" in new created console

ConEmu commented 9 years ago

From pfeif...@tzi.de on June 27, 2013 04:38:06

Yes, but how can I refer in the new console to the %CD% of the original console? Or in other words how can I pass %CD% of the current console to the new cmd.exe?

Unfortunately the obvious solution doesn't work:

Shell("open","cmd.exe","/k cd /d %CD%")

ConEmu commented 9 years ago

From ConEmu.M...@gmail.com on June 27, 2013 04:50:46

You can't use "shell" - it start programs from ConEmu context, but not from your active application context. ConEmu does not know anything about active application context, only active application may run new app depending on its active state.

What you may do I wrote in ConEmu #3.

ConEmu commented 9 years ago

From pfeif...@tzi.de on June 27, 2013 05:11:52

Sorry, I thought that ...

Shell("new_console:b")

... will duplicate the current console in the background since there is no dedicated "tabduplicate" command.

Anyway I have no idea how to bring these three command in a sequence:

  1. Duplicate the current console in the background.
  2. print the command line for launches DOpus
  3. Close the temporary tab in the background.
ConEmu commented 9 years ago

From pfeif...@tzi.de on June 28, 2013 05:30:14

Can you give me a more detailed example on how I get this command working?

Thanks for your patience!

ConEmu commented 9 years ago

From pfeif...@tzi.de on June 28, 2013 05:44:52

This is the current command that should be executed in a temporary duplicated console (which should be closed after command execution automatically):

print("\e\"C:\Program Files\Directory Opus\dopusrt.exe\" /cmd Go \"%CD%\" NEWTAB\n")

ConEmu commented 9 years ago

From ConEmu.M...@gmail.com on June 28, 2013 08:16:37

Wait for the next build

ConEmu commented 9 years ago

From ConEmu.M...@gmail.com on July 02, 2013 15:27:47

smth like

shell("new_console:Ibn","cmd","/k \"C:\Program Files\Directory Opus\dopusrt.exe\" /cmd Go \"%CD%\" NEWTAB && exit")

ConEmu commented 9 years ago

From pfeif...@tzi.de on July 03, 2013 01:59:50

Works like a charm. Thank you very much!

ConEmu commented 9 years ago

From ConEmu.M...@gmail.com on July 03, 2013 02:03:45

Status: Verified

ConEmu commented 9 years ago

From pfeif...@tzi.de on July 03, 2013 02:34:30

Is it possible to call two GuiMacro commands in a sequence when pressing a single hotkey?

For example duplicating the tab and minimizing the ConEmu window?

ConEmu commented 9 years ago

From ConEmu.M...@gmail.com on July 03, 2013 02:57:41

Just delimit macros with spaces

ConEmu commented 9 years ago

From pfeif...@tzi.de on January 15, 2014 02:29:24

The %CD% does not refer to the correct path if the console is launched from an external program and grabbed by ConEmu .

If I start the cmd.exe by using the start menu, %CD% refers to the correct path. But if I start cmd.exe by using an external program (e.g. DOpus), %CD% always refer to "C:\Program Files\ ConEmu \ ConEmu " even if I navigate around using cd command.

ConEmu commented 9 years ago

From pfeif...@tzi.de on January 16, 2014 01:42:48

The wrong %CD% still occurs in the newest version 140114.

Should I create a new issue, or does this problem belongs to this one?

ConEmu commented 9 years ago

From pfeif...@tzi.de on January 16, 2014 01:48:29

BTW: The same problem occurs when I duplicate a tab by using the macro "Shell("new_console:I")", in this case the duplicated console will be placed in ConEmu home directory (instead of the current working directory of the source tab).

ConEmu commented 9 years ago

From pfeif...@tzi.de on April 30, 2014 02:03:34

This seems to be fixed now.