avoid cmd popup with custom command in Ctrl+D menu

English support forum

Moderators: white, Hacker, petermad, Stefan2

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 »

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: 9364
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 »

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
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post by *petermad »

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 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | 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 »

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 »

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: 1803
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 »

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