Page 1 of 2

TC 9: 'numeric parameter for commands'; allow ? parameter

Posted: 2016-06-10, 12:31 UTC
by Stefan2
Related to
HISTORY.TXT wrote:5.05.16 Added: The following commands now accept a numeric parameter in the button bar or start menu:
CM_WAIT CM_SELECT CM_UNSELECT CM_REVERSE CM_GOTOFIRSTENTRY M_GOTOFIRSTFILE
CM_SWITCHDRIVE CM_DELETE CM_LEFTSWITCHTOTHISCUSTOMVIEW
CM_RIGHTSWITCHTOTHISCUSTOMVIEW CM_SEARCHFORINCURDIR CM_DIRECTORYHOTLIST (32/64)

I want to use CM_SELECT in button.

But since I can't add a question-mark '?' into the parameter box, (to prompt the user for wanted amount)

I want to suggest to let TC interpret a '?' entered as 'numeric parameter' as user wish
to show the command-preview box (like the '?' would be if entered into the parameter field).


CMD: CM_SELECT ?
PARAM:
ICON:
TOOLTIP:
Prompt user how many to select down.



 

Re: TC 9: 'numeric parameter for commands'; allow ? paramete

Posted: 2016-06-10, 15:39 UTC
by nsp
Stefan2 wrote:Related to
HISTORY.TXT wrote:5.05.16 Added: The following commands now accept a numeric parameter in the button bar or start menu:
CM_WAIT CM_SELECT CM_UNSELECT CM_REVERSE CM_GOTOFIRSTENTRY M_GOTOFIRSTFILE
CM_SWITCHDRIVE CM_DELETE CM_LEFTSWITCHTOTHISCUSTOMVIEW
CM_RIGHTSWITCHTOTHISCUSTOMVIEW CM_SEARCHFORINCURDIR CM_DIRECTORYHOTLIST (32/64)
....
CMD: CM_SELECT ?
PARAM:
ICON:
TOOLTIP:
Prompt user how many to select down.
In fact the issue is that is it not known as command with parameter which allows you to add a question mark or use a %A if you embed it into em_command. The worst is that even on the command bar, you cannot use cm_select 3 (you only select one file at the time whatever the number you pass !).

It makes the command useless if you cannot enter any parameter from the command line or using a flexible em_cmd with %A.... and adding just ? on the cmd definition will not help.

Posted: 2016-06-10, 19:49 UTC
by ghisler(Author)
Nice idea, I will try to add ? support and command line support.

Posted: 2016-06-16, 19:07 UTC
by Stefan2
Total Commander 9.0 beta 2


CMD: CM_SELECT ? (Prompt user for wanted amount)
and
CMD: CM_SELECT ?50 (Prompt user with default amount)


works as button and on command line.




Good additional idea and very useful, thanks Mr. Ghisler.


Will test other commands too, if time permits.

Posted: 2016-06-16, 20:13 UTC
by MVV
Would be useful also to send commands with parameters via WM_COPYDATA, just like EM-commands.

Posted: 2016-06-17, 15:53 UTC
by ghisler(Author)
You can send them via wm_user+51, just put CM_SELECT in wParam and the number in lParam!

Posted: 2016-06-17, 17:01 UTC
by MVV
ghisler(Author),
I mean that there are some commands with string parameters that can't be sent this way (e.g. SELECTFILES or OPENBAR1). So it would be nice to be able to send all commands from section 'with parameters' by sending them like they were typed in command line.

Posted: 2016-06-19, 06:27 UTC
by nsp
MVV wrote:ghisler(Author),
I mean that there are some commands with string parameters that can't be sent this way (e.g. SELECTFILES or OPENBAR1). So it would be nice to be able to send all commands from section 'with parameters' by sending them like they were typed in command line.
MVV, if you give a look to the section command with parameter, you will not see any of these.
It is very unfortunate that we cannot have a standard way to call all TC commands and that the behavior of parameter is not the same from a button, menu or from command bar, external applications. (%L %S....)

Posted: 2016-06-19, 08:58 UTC
by MVV
nsp,
I see CM_WAIT there. :)
Anyway, we need a way to call these commands, just like we can call cd or EM-commands via WM_COPYDATA.
Of course there is a way via creating separate EM-command for every command but...

Posted: 2016-06-19, 14:23 UTC
by ghisler(Author)
OK, I will allow cm_xyz commands via the WM_COPYDATA function accepting em_xyz commands.

Posted: 2016-06-20, 10:47 UTC
by nsp
ghisler(Author) wrote:OK, I will allow cm_xyz commands via the WM_COPYDATA function accepting em_xyz commands.
Thanks a lot ghisler(Author) :D :)

Posted: 2016-06-22, 15:57 UTC
by MVV
I can't make CM_commands with parameters working via WM_COPYDATA, nothing happens.

E.g.:

Code: Select all

TCFS2 /ef "tem(`em_AnyCommand`)" - works
TCFS2 /ef "tem(`CM_SELECT 5`)" - doesn't work
(tem command sends regular EM-command to TC)

However CM_SELECT 5 works in TC command line.


And, what about allowing all commands with parameters to be started via WM_COPYDATA? I mean commands like LOADSEARCH or SYNCOPEN...

Posted: 2016-06-22, 23:52 UTC
by nsp
MVV wrote:I can't make CM_commands with parameters working via WM_COPYDATA, nothing happens.

E.g.:

Code: Select all

TCFS2 /ef "tem(`em_AnyCommand`)" - works
TCFS2 /ef "tem(`CM_SELECT 5`)" - doesn't work
(tem command sends regular EM-command to TC)

However CM_SELECT 5 works in TC command line.


And, what about allowing all commands with parameters to be started via WM_COPYDATA? I mean commands like LOADSEARCH or SYNCOPEN...
With Powerpro copydata for em cmd works also with cm_command ! TC 32/64bit 9b3
cm_select 6 works !

But Command with parameters like CD, SELECTFILES, OPENBAR, .... LOADSEARCH seems to not be supported yet. (unless wrapped into EM_XXX %A)

Posted: 2016-06-23, 07:23 UTC
by MVV
Wow, cm_select 6 works with TCFS2 too!

So we have the following:
1. From TC command line command names are case insensitive.
2. From WM_COPYDATA for EM-comands command names are case sensitive.

It is strange why TC doesn't use same parser in both cases.

Posted: 2016-06-23, 09:38 UTC
by ghisler(Author)
Ah, you are half-right_ both the cm_ and em_ prefix must be lowercase to make it work! I will change it. For now, please use all lowercase commands, that should work.