TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
andry81
Junior Member
Junior Member
Posts: 97
Joined: 2018-11-22, 19:17 UTC

TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *andry81 »

I have a buttonbar:

Code: Select all

[Buttonbar]
Buttoncount=1
cmd1=...\call.vbs
param1=... "%P" %WL "%T"
param1
turns out to be empty if
%WL
selects nothing, which generates an empty command line without parameters at all:

Code: Select all

...\call.vbs <nothing-is-here>
Some clarification:
When a directory is empty the cursor is always on `[..]` item. When cursor is not on the `[..]` item, then selection is not empty.
For example, to select nothing put the cursor on a parent directory:
[..]
Last edited by andry81 on 2020-11-11, 14:25 UTC, edited 2 times in total.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *gdpr deleted 6 »

I fail to reproduce with TC 9.51 65-bit on Win7.

If there is no selection, the command line is intact, and the list generated contains the file/folder path of the item under the cursor (as expected).

How did you determine that there are no commandline arguments passed to your vbs script?

Not that there is some other error in your script that perhaps made you mistakenly believe that there were no commandline arguments passed. For diagnosing your issue, i suggest to exchange your vbs script with another simple vbs script that simply outputs the commandline arguments passed to it, and nothing more. For instance:

Code: Select all

Dim output
For i = 0 To WScript.Arguments.Count - 1
    output = output & i & ": " & WScript.Arguments(i) & vbCrLf
Next
Wscript.Echo output
andry81
Junior Member
Junior Member
Posts: 97
Joined: 2018-11-22, 19:17 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *andry81 »

Code: Select all

MsgBox "Count:" & WScript.Arguments.Count
Put cursor on a parent directory:
[..]
Result:
Count:0
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *gdpr deleted 6 »

With the cursor being set on the ".." item, i can now reproduce the issue. No arguments passed... :(

The fact that the item under the cursor should be "[..]" should probably be edited into the report (and/or title of the report).
andry81
Junior Member
Junior Member
Posts: 97
Joined: 2018-11-22, 19:17 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *andry81 »

The fact that the item under the cursor should be "[..]" should probably be edited into the report (and/or title of the report).
When a directory is empty the cursor is always on `[..]` item. When cursor is not on the `[..]` item, then selection is not empty.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *gdpr deleted 6 »

Your report (and its title) currently only speaks about "nothing is selected"/"selects nothing".
What's so bad about making the report itself more clear?
andry81
Junior Member
Junior Member
Posts: 97
Joined: 2018-11-22, 19:17 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *andry81 »

I don't quite understand what you want. If you want to change the title then make a suggestion. Currently all details inside the first message.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *Stefan2 »

- right click to modify an button
- open Help
- read:
%Y anywhere in the parameters: Pass empty list to program when using one of the List parameters like %L.
Otherwise, the file under the cursor would be passed.

Maybe THAT?




The History.txt explain it better IMHO:
Total Commander 9.20
04.04.18 Added: New button bar parameter %Y anywhere in the parameter list:
Allow empty lists when nothing is selected for parameters %S, %R, %L, %l, %F, %f, %D, %d, %WL, %WF, %UL and %UF (32/64)


So me think the help could read:
%Y anywhere in the parameters: if one of the List parameters like %L is used but NOTHING is selected,
then at least a EMPTY list is passed (to an external program or script), else just the current object under the cursor would be passed.




HTH? :roll:
 
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *gdpr deleted 6 »

andry81 wrote: 2020-11-11, 03:17 UTC I don't quite understand what you want. If you want to change the title then make a suggestion. Currently all details inside the first message.
I did:
The fact that the item under the cursor should be "[..]" should probably be edited into the report (and/or title of the report).
You even replied to it. Anyway... :?
andry81
Junior Member
Junior Member
Posts: 97
Joined: 2018-11-22, 19:17 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *andry81 »

%Y anywhere in the parameters: Pass empty list to program when using one of the List parameters like %L.
Otherwise, the file under the cursor would be passed.
It changes the behaviour. %L does not require to mark a selection, enough just put the cursor on any item except the `[..]` to select a single item.
The `%Y` argument brings the requirement to always mark a selection, otherwise the file list would be still empty.
It's kind of a different behaviour I don't want a user to deal with it.
andry81
Junior Member
Junior Member
Posts: 97
Joined: 2018-11-22, 19:17 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *andry81 »

You even replied to it. Anyway...
Sorry, but u didn't suggest anything to change the title.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *gdpr deleted 6 »

andry81 wrote: 2020-11-12, 19:37 UTC
You even replied to it. Anyway...
Sorry, but u didn't suggest anything to change the title.
Hmm, how comes that the things i wrote in parentheses became invisible to you...? :?
I obviously suggested to either edit the post and/OR the title -- it's in plain sight right there in my second comment.

Anyways, that suggestion of mine was from a time before you enhanced your report.
The way it is now is totally fine, i am not complaining. Lets end this "You didn't say" ... "But i said" forth-and-back. There is nothing else to be gained than polluting the thread and possibly some mildy entertaining verbal slapping contest which i wager the mods would not be very amused of.
andry81
Junior Member
Junior Member
Posts: 97
Joined: 2018-11-22, 19:17 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *andry81 »

Hmm, how comes that the things i wrote in parentheses became invisible to you...?
I obviously suggested to either edit the post and/OR the title -- it's in plain sight right there in my second comment.
My initial question was about title not the post.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *ghisler(Author) »

People complained that they couldn't launch apps when nothing was selected, so I made these two options:
1. Without the %Y argument, TC assumes that the user wants to launch the app without parameters
2. With the %Y argument, TC assumes that the user wants to open the app with an empty list.
Author of Total Commander
https://www.ghisler.com
andry81
Junior Member
Junior Member
Posts: 97
Joined: 2018-11-22, 19:17 UTC

Re: TC9.51: `%WL` generates an empty command line parameters if nothing is selected

Post by *andry81 »

People complained that they couldn't launch apps when nothing was selected, so I made these two options:
1. Without the %Y argument, TC assumes that the user wants to launch the app without parameters
2. With the %Y argument, TC assumes that the user wants to open the app with an empty list.
But there is more difference:
1. Without the %Y, does not need to select a single file with the Insert button, enough to put cursor on any item except the `[..]`
2. With the %Y, does need to select at least one item with the Insert button, cursor does not select anything now
Post Reply