Chaining of command in directory hotlist possible?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
EricB
Senior Member
Senior Member
Posts: 357
Joined: 2008-03-25, 22:21 UTC
Location: The Netherlands

Chaining of command in directory hotlist possible?

Post by *EricB »

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
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

AFAIK you can only chain cm_ or em_ commands, not cd command.
Sequence cm_SrcQuickview,cm_VerticalPanels works fine.
User avatar
white
Power Member
Power Member
Posts: 6015
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Chaining of command in directory hotlist possible?

Post by *white »

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, chaining commands also works in directory hotlist. And also when defining a custom command.

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.
User avatar
EricB
Senior Member
Senior Member
Posts: 357
Joined: 2008-03-25, 22:21 UTC
Location: The Netherlands

Post by *EricB »

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
User avatar
white
Power Member
Power Member
Posts: 6015
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

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 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.

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.
User avatar
EricB
Senior Member
Senior Member
Posts: 357
Joined: 2008-03-25, 22:21 UTC
Location: The Netherlands

Post by *EricB »

white wrote: You are mixing up associations with commands.
Possibly, I'm no veteran in this area.
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.
Help shows the use of %A or %A1..%A9, but this did not work either.
white wrote: You will have to define a custom command like em_cdsomedir and put "cd %commander_drive%\somedir" in the command 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: 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.
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.

Regards, EricB
User avatar
white
Power Member
Power Member
Posts: 6015
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

EricB wrote:
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.
Help shows the use of %A or %A1..%A9, but this did not work either.
Help states "Only when defining alias commands:" This means these variables only work when the command line is used.
EricB wrote:Seems this is not going to work the way I would like it.
Indeed.
EricB wrote:Thanks for elaborating on this.
You are welcome.
User avatar
nsp
Power Member
Power Member
Posts: 1954
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

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

Code: Select all

%commander_exe% /o /t /s %commander_drive%\tools
This will open a new tab in tools folder of %commander_drive% and it is almost what you need ;)
User avatar
EricB
Senior Member
Senior Member
Posts: 357
Joined: 2008-03-25, 22:21 UTC
Location: The Netherlands

Post by *EricB »

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
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

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.
User avatar
EricB
Senior Member
Senior Member
Posts: 357
Joined: 2008-03-25, 22:21 UTC
Location: The Netherlands

Post by *EricB »

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.
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!

Regards, EricB
Post Reply