Menu item executing multiple commands
Moderators: white, Hacker, petermad, Stefan2
Menu item executing multiple commands
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.
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.
- ghisler(Author)
- Site Admin
- Posts: 48199
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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...
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
https://www.ghisler.com
Re: Menu item executing multiple commands
Hi JohnTC,
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.
Yes you can use an external script.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.
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.
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.):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
Code: Select all
MENUITEM "Test dual commands", cm_focusTrg,cm_SelectAll
PS: I use TC 9.12 x64 on a Windows 8.1 x64 PC.
![Question :?:](./images/smilies/icon_question.gif)
HerbieH*
-Keep on makin' music!
-Keep on makin' music!
- ghisler(Author)
- Site Admin
- Posts: 48199
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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
https://www.ghisler.com
It worked perfectly with several multiple comma-separated cm_ and em_ commands in a new entry in my 'Wcmd_herbieh.ini' file.
Example:
Thank you for the help. ![Smile :)](./images/smilies/icon_smile.gif)
PS: I wonder how many commands there can be?![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Example:
Code: Select all
[em_multi1]
cmd=cm_focusTrg,cm_SelectAll
menu=multi1
![Smile :)](./images/smilies/icon_smile.gif)
PS: I wonder how many commands there can be?
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
HerbieH*
-Keep on makin' music!
-Keep on makin' music!