can't send usercmd with param in button and directory menu

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
dindog
Senior Member
Senior Member
Posts: 315
Joined: 2010-10-18, 07:41 UTC

can't send usercmd with param in button and directory menu

Post by *dindog »

TC will prompt error when try to input a usercmd with param:

Code: Select all

; internal CD can have param like "c:"
CD c:\ 
; while usercmd can't
; [em_cd]
; cmd=cd
; param=%A
em_cd c:\
;prompt "File not found. \n em_cd c:\"
em_cd c:\ works fine in TC's commandline and also tcfs2 by

Code: Select all

tcfs2 /ef "tem(`em_cd c:\`)"
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: can't send usercmd with param in button and directory menu

Post by *ghisler(Author) »

User commands with parameters are NOT supported when coming from outside of TC, for security reasons.
Author of Total Commander
https://www.ghisler.com
User avatar
dindog
Senior Member
Senior Member
Posts: 315
Joined: 2010-10-18, 07:41 UTC

Re: can't send usercmd with param in button and directory menu

Post by *dindog »

ghisler(Author) wrote: 2019-11-01, 15:36 UTC User commands with parameters are NOT supported when coming from outside of TC, for security reasons.
What do you mean outside? TC's own button and directory menu command is outside?

And the current situation is, an outside tools tcfs2 can send em_usercmd to TC properly just the same as I input in the TC's own commandline, but not working in TC's own command line of button and hotlist... I don't see the logic
User avatar
petermad
Power Member
Power Member
Posts: 14807
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: can't send usercmd with param in button and directory menu

Post by *petermad »

I don't see the logic
Neither do I.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: can't send usercmd with param in button and directory menu

Post by *ghisler(Author) »

The problem in the button bar is that you can have multiple commands separated by comma, and the parameter behind em_cd could also contain a comma (they are allowed in paths).
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14807
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: can't send usercmd with param in button and directory menu

Post by *petermad »

So, it is not really a security problem, but a syntax problem.
Last edited by petermad on 2019-11-04, 22:30 UTC, edited 1 time in total.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: can't send usercmd with param in button and directory menu

Post by *Stefan2 »

How about to separate multiple commands as alternative by pipe | too additionally to by comma separator?
So people who have a comma in paths can use a pipe instead, and all others too, and comma is only there for backward compatibility.




 
User avatar
dindog
Senior Member
Senior Member
Posts: 315
Joined: 2010-10-18, 07:41 UTC

Re: can't send usercmd with param in button and directory menu

Post by *dindog »

Stefan2 wrote: 2019-11-04, 18:13 UTC How about to separate multiple commands as alternative by pipe | too additionally to by comma separator?
So people who have a comma in paths can use a pipe instead, and all others too, and comma is only there for backward compatibility.
pipe can be a parameter for some command too, I think a solution to solve it for long is multi-commnad input box for mulit-commnad,
it can be a button at the current command input "add sequence command", then you can input the second line command for the 2nd command, and one more click will add 3rd commnad, and so on.

Or a check-box for "multi-command", when it's checked, the commandline input can be expand as a mulit-line textbox which can seperate different commands by different line.

Any solution above will allow both mulit command sequence and command parameters at the same time... I think this will greatly enhance the TC inside functionality
User avatar
petermad
Power Member
Power Member
Posts: 14807
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: can't send usercmd with param in button and directory menu

Post by *petermad »

I think a solution to solve it for long is multi-commnad input box for mulit-commnad,
it can be a button at the current command input "add sequence command", then you can input the second line command for the 2nd command, and one more click will add 3rd commnad, and so on.

Or a check-box for "multi-command", when it's checked, the commandline input can be expand as a mulit-line textbox which can seperate different commands by different line.
Multicommands are not just used in Buttons, they are for exampel also allowed in View Modes as autorun commands, wgere there is no space for such an elaborate approach.

Maybe just make it so that parameter behind em_command should be quoted if they contain a comma (em_cd "c:\my,file.ext") - TC should accept double quotes in case the parameter is already quoted.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
dindog
Senior Member
Senior Member
Posts: 315
Joined: 2010-10-18, 07:41 UTC

Re: can't send usercmd with param in button and directory menu

Post by *dindog »

I find one more place can not send em_command param...The autorun-command in View Mode. If I access one of the view mode and want it come with filter, I can user

Code: Select all

[em_cdDWG]
cmd=cd
param=*.*|*.bak *.dwl *.dwl2
but not

Code: Select all

[em_cd]
cmd=cd
param=%A
em_cd *.*|*.bak *.dwl2
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: can't send usercmd with param in button and directory menu

Post by *ghisler(Author) »

This is indeed not supported, sorry.
Author of Total Commander
https://www.ghisler.com
Post Reply