Chaining of command in directory hotlist possible?
Moderators: Hacker, petermad, Stefan2, white
Chaining of command in directory hotlist possible?
Hi,
One of the new features in TC 8.5 Beta is the possibility to chain internal commands. I tried to use this in the directory hotlist for an entry like this:
cm_OpenNewTab,cd %commander_drive%\somedir
but this just renders a 'File not found' message. I remember to have read somewhere that TC treats CD as an internal command, so I would expect this to be possible. Or should I define an em_cd for this?
Regards, EricB
One of the new features in TC 8.5 Beta is the possibility to chain internal commands. I tried to use this in the directory hotlist for an entry like this:
cm_OpenNewTab,cd %commander_drive%\somedir
but this just renders a 'File not found' message. I remember to have read somewhere that TC treats CD as an internal command, so I would expect this to be possible. Or should I define an em_cd for this?
Regards, EricB
Re: Chaining of command in directory hotlist possible?
Yes, chaining commands also works in directory hotlist. And also when defining a custom command.EricB wrote:One of the new features in TC 8.5 Beta is the possibility to chain internal commands. I tried to use this in the directory hotlist for an entry like this:
cm_OpenNewTab,cd %commander_drive%\somedir
but this just renders a 'File not found' message. I remember to have read somewhere that TC treats CD as an internal command, so I would expect this to be possible. Or should I define an em_cd for this?
Yes, you have to define an em_cd command. The chain has to consist of existing cm_ and em_ commands. If one of the commands is not an existing cm_ or em_ command, the command string is interpreted as a single (unchained) command line. So in the example you gave, Total Commander will execute for example "cm_OpenNewTab,cd.exe" if this program is present in the current folder(*). Copy for example calc.exe to cm_OpenNewTab,cd.exe in the current folder and try it.
(*) Assuming you are using directory hotlist. If you are using a button, the location depends on the Start path field.
I tried to define user command em_cd with command CD and parameter %1 but to no avail. It looks like the command will not pass/parse the parameter, which will be necessary when doing a cd...
Edit:
At least it does not work in the Directory hotlist. When using it from command line, it works as expected: em_cd \ will change to drive root.
Edit2: but when using an environment variable it also does NOT work from command line. em_cd %commander_path% does not work.
Edit3: using em_cd d:\tools (so a hard coded path, no env var) does also not work in directory hotlist, whereas env vars are accepted when using cd
So it seems indeed a problem with parsing arguments and expanding environment variables.
Regards, EricB
Edit:
At least it does not work in the Directory hotlist. When using it from command line, it works as expected: em_cd \ will change to drive root.
Edit2: but when using an environment variable it also does NOT work from command line. em_cd %commander_path% does not work.
Edit3: using em_cd d:\tools (so a hard coded path, no env var) does also not work in directory hotlist, whereas env vars are accepted when using cd
So it seems indeed a problem with parsing arguments and expanding environment variables.
Regards, EricB
You are mixing up associations with commands. Parameter %1 does nothing. Try leaving it out, or replace it by %2. Click the help button to see what variables are allowed in the parameter field.EricB wrote:I tried to define user command em_cd with command CD and parameter %1 but to no avail. It looks like the command will not pass/parse the parameter, which will be necessary when doing a cd...
Edit:
At least it does not work in the Directory hotlist. When using it from command line, it works as expected: em_cd \ will change to drive root.
Edit2: but when using an environment variable it also does NOT work from command line. em_cd %commander_path% does not work.
Edit3: using em_cd d:\tools (so a hard coded path, no env var) does also not work in directory hotlist, whereas env vars are accepted when using cd
You will have to define a custom command like em_cdsomedir and put "cd %commander_drive%\somedir" in the command field.
Note:
You can not type anything behind an em_ command except on the command line. A parameter typed on the command line will replace the parameter field of the em_ command, or the parameter will be inserted in the parameter field if a variable %A1..%A9 is used in the parameter field.
Using "em_cd d:\tools" in the directory hotlist will not be recognized as an internal command. It will execute em_cd.exe in the current folder.
Possibly, I'm no veteran in this area.white wrote: You are mixing up associations with commands.
Help shows the use of %A or %A1..%A9, but this did not work either.white wrote: Parameter %1 does nothing. Try leaving it out, or replace it by %2. Click the help button to see what variables are allowed in the parameter field.
Well, this defeats the purpose of having a generic em_CD command that accepts a dirname (with or without environment variables) as parameter.white wrote: You will have to define a custom command like em_cdsomedir and put "cd %commander_drive%\somedir" in the command field.
So if I understand correctly, only em_ on the command line will accept a parameter. The only reason for me to go through this was to be able to chain an OpenNewTab command to a CD command in the directory hotlist. Seems this is not going to work the way I would like it. Thanks for elaborating on this.white wrote: Note:
You can not type anything behind an em_ command except on the command line. A parameter typed on the command line will replace the parameter field of the em_ command, or the parameter will be inserted in the parameter field if a variable %A1..%A9 is used in the parameter field.
Using "em_cd d:\tools" in the directory hotlist will not be recognized as an internal command. It will execute em_cd.exe in the current folder.
Regards, EricB
Help states "Only when defining alias commands:" This means these variables only work when the command line is used.EricB wrote:Help shows the use of %A or %A1..%A9, but this did not work either.white wrote: Parameter %1 does nothing. Try leaving it out, or replace it by %2. Click the help button to see what variables are allowed in the parameter field.
Indeed.EricB wrote:Seems this is not going to work the way I would like it.
You are welcome.EricB wrote:Thanks for elaborating on this.
This is not chaining command as em_cmd can only be completed on command line or by sending message to TC.
// this is a pity but this is the way it works for now ..... //
But from the directory hotlist, you can also call This will open a new tab in tools folder of %commander_drive% and it is almost what you need 
// this is a pity but this is the way it works for now ..... //
But from the directory hotlist, you can also call
Code: Select all
%commander_exe% /o /t /s %commander_drive%\tools

Nice one! Different approach, but same outcome, at least the one I was looking for. Thx, nsp!
The only drawback is that all entries in the Directory Hotlist would have to be changed in this fashion.
I'm wondering if Christian would consider this as a feature: add a checkmark in the entry's configuration which enables it to open it in a new tab, or keep the current behaviour (no clue how to solve this internally, since we're looking at two different command sets).
Regards, EricB
The only drawback is that all entries in the Directory Hotlist would have to be changed in this fashion.
I'm wondering if Christian would consider this as a feature: add a checkmark in the entry's configuration which enables it to open it in a new tab, or keep the current behaviour (no clue how to solve this internally, since we're looking at two different command sets).
Regards, EricB
Duh! Completely missed that one. Just as well I was too lazy to post a suggestion as yet... The Shift option should do for now... Thx MVV!MVV wrote:BTW you can open directories from hotlist in new tabs by holding Shift...
BTW2 you can use TCMC or TCFS2, both support new tabs and source/target instead of left/right mode.
Regards, EricB