Menu item executing multiple commands

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
JohnTC
Junior Member
Junior Member
Posts: 33
Joined: 2005-03-05, 03:36 UTC

Menu item executing multiple commands

Post by *JohnTC »

Greetings fellow TCians and denizens of the forums:

It must be possible to create a menu item that executes multiple commands. An example might be a single menu entry that executes these commands in order:

copy these files to here
make this directory
copy those files to there

I would prefer to execute the sequence entirely with TC commands, although if that won't work I suppose I could execute a batch file or a PS script.

Thank you in advance.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Simple commands like cm_something or user defined like em_something can be chained with a comma, e.g.
cm_focusleft,cm_selectall,cm_copy

But commands which can be moved to the background like cm_copy will not wait for the next command to execute...
Author of Total Commander
https://www.ghisler.com
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Menu item executing multiple commands

Post by *Stefan2 »

Hi JohnTC,
JohnTC wrote:
copy these files to here
make this directory
copy those files to there

... I suppose I could execute a batch file or a PS script.
Yes you can use an external script.
To look-up how TC can support you, do
- right click a button
- choose Change...
- press F1 key and read
- cancel the button dialog


Examples from the help:
%P the source path
%N the file name
%T the current target path.


TC can provide a list of selected files and folders,
one per line, use your scripting tool to proceed one line after the other:
%L Long file names including the complete path, e.g. c:\Program Files\Long name.exe
%F Long file names without path, e.g. Long name.exe


and many more.

Also search the forum for WM_User to communicate with TC from a script.

There can be found many examples in the forum. If nothing found, just ask.




 
JohnTC
Junior Member
Junior Member
Posts: 33
Joined: 2005-03-05, 03:36 UTC

Post by *JohnTC »

Thank you both of you!
User avatar
HerbieH
Member
Member
Posts: 145
Joined: 2003-02-11, 10:04 UTC

Post by *HerbieH »

Ghisler: Simple commands like cm_something or user defined like em_something can be chained with a comma, e.g. cm_focusleft,cm_selectall,cm_copy
I get an error on TC start, when I write the following in my personal 'Wcmd_herbieh.mnu' file (connected correctly to my own .lng file etc.):

Code: Select all

MENUITEM "Test dual commands", cm_focusTrg,cm_SelectAll
When I use it in a button, it works perfectly.

PS: I use TC 9.12 x64 on a Windows 8.1 x64 PC.

:?:
HerbieH*
-Keep on makin' music!
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Post by *Gral »

You can use direct command chain in buttons and start menu.
For other menus build user command with two or more internal commands.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

You cannot have multiple commands on a menu item. Instead, define a custom command, e.g. em_multi1 containing the commands. Then put that in the main menu.
Author of Total Commander
https://www.ghisler.com
User avatar
HerbieH
Member
Member
Posts: 145
Joined: 2003-02-11, 10:04 UTC

Post by *HerbieH »

It worked perfectly with several multiple comma-separated cm_ and em_ commands in a new entry in my 'Wcmd_herbieh.ini' file.

Example:

Code: Select all

[em_multi1]
cmd=cm_focusTrg,cm_SelectAll
menu=multi1
Thank you for the help. :)

PS: I wonder how many commands there can be? :roll:
HerbieH*
-Keep on makin' music!
Post Reply