avoid cmd popup with custom command in Ctrl+D menu

English support forum

Moderators: Stefan2, white, sheep, Hacker

Post Reply
slymz
Junior Member
Junior Member
Posts: 8
Joined: 2013-12-13, 19:04 UTC

avoid cmd popup with custom command in Ctrl+D menu

Post by *slymz » 2019-04-01, 13:37 UTC

For certain items in Ctrl+D (Change Directory menu), I use a batch/perl etc script to call back into Total Commander. Such as

Code: Select all

@echo off

rem bunch of custom code based on the current directory to compute jump target
set abspath=%jumpTarget%
c:\opt\totalcmd\totalcmd.exe /O /S "%abspath%"
and in Change Directory menu, I add an item whose "Command:" is a call to this script.

Everything works great, except that there is an annoying brief pause and a cmd window that flashes on screen. It takes about half a second... which is a long enough distraction every time one changes directories, and is totally against the spirit of Total Commander-ism.

How can I get rid of the annoying cmd window?

Is there a better way to integrate custom scripts with Total Commander? (for example, is there a way to add new cm_% based commands, via plugins or similar?)

User avatar
Dalai
Power Member
Power Member
Posts: 6678
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: avoid cmd popup with custom command in Ctrl+D menu

Post by *Dalai » 2019-04-01, 16:51 UTC

Maybe it's possible to change the call to the script to something like this:

Code: Select all

cmd.exe /c start /min "" <your_script_here>
Or use NirCmd which provides a similar option to minimize the called command

Code: Select all

NirCmd.exe exec min <your_script_here>
.

Regards
Dalai
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups

User avatar
petermad
Power Member
Power Member
Posts: 8468
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: avoid cmd popup with custom command in Ctrl+D menu

Post by *petermad » 2019-04-01, 20:17 UTC

2slymz
You could make an em_command to start your script - in an em_command you can choose to minimize the script console:

Run cm_CommandBrowser from command line and then: http://madsenworld.dk/tcmd/em_command.png

Then use that em_command in your Ctrl+D menu
License #524 (1994)
Danish Total Commander Translator
TC 9.22a 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 (1903) 64bit, 'Everything' 1.4.1.935 (x64)
TC 3.0b6 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

slymz
Junior Member
Junior Member
Posts: 8
Joined: 2013-12-13, 19:04 UTC

Re: avoid cmd popup with custom command in Ctrl+D menu

Post by *slymz » 2019-04-17, 14:17 UTC

You could make an em_command to start your script - in an em_command you can choose to minimize the script console:
Exactly what i've been looking for. This is amazing! Thanks

slymz
Junior Member
Junior Member
Posts: 8
Joined: 2013-12-13, 19:04 UTC

Re: avoid cmd popup with custom command in Ctrl+D menu

Post by *slymz » 2019-04-17, 14:36 UTC

Is it possible to define user commands that accept arguments?

For example here, let's say my script is foo.bat. It takes one optional argument. And, per original description, uses initial logic to compute `%jumptarget%`. If the optional argument is present, which is a relative path, it would cd to `%jumptarget%\%1`

I can defined `em_foo` to be my usercmd alias for calling `foo.bat` with "minimize" etc settings. Then I can add various Ctrl+D items that uses em_foo with the argument.

In the lack of this capability, I'd have to declare additional usercmd's, each repeating the same settings with minor variation.

User avatar
nsp
Power Member
Power Member
Posts: 1208
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: avoid cmd popup with custom command in Ctrl+D menu

Post by *nsp » 2019-04-17, 16:39 UTC

The only way to define open parameters in user command is to use %A (i.e. %A1 %A2....) in the parameter section. (or ?%A to have popup for buttons)
With this, you can use the em_cmd from the command line, for button with popup (if you added ?), sending messages with scripting language.

But you cannot define multiple button with predefined sets targeting the same em_cmd. It is a bit weird ...

This could be a good suggestion ;)

Post Reply