How to get list of selected files?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

How to get list of selected files?

Post by *LonerD »

Hi.
How can I get list of selected files and directories (with full paths and only names)? Only for selected. If there are no selection - the list must be empty.
Commands 2017 and 2018 works not fine for me - they copy to clipboard name of file/directory under cursor if no selection in panel.
Maybe there some tricks for it?
Or even better Autohotkey realization?
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: How to get list of selected files?

Post by *nsp »

LonerD wrote:Hi.
How can I get list of selected files and directories (with full paths and only names)? Only for selected. If there are no selection - the list must be empty.
Commands 2017 and 2018 works not fine for me - they copy to clipboard name of file/directory under cursor if no selection in panel.
Maybe there some tricks for it?
Or even better Autohotkey realization?
The current behaviour is :
If no file is selected, you get the current file.
If one or more files are selected you get only the selected one !
You can get all files insisde a temporary file using %L %l %F %f in command parameters...
You can get all in the command line using %S or %P%S ...

AutoHotKey UI script with Total Commander 64Bit is not very used anymore :(

--Edited:
If you speak russsian, you can give a look to TCIMG or ask in russian forum !
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Post by *LonerD »

Autohotkey realization?
I made it !!

Code: Select all

; Copy to clipboard list of only selected files and directories
#NoEnv
#NoTrayIcon
#MaxMem 1024
#SingleInstance force
SetBatchLines, -1

If not ( WinExist("ahk_class TTOTAL_CMD") || WinActive("ahk_class TTOTAL_CMD") )
  ExitApp

Clipboard := ""

WinGet, hw_TTOTAL_CMD, ID, A
ControlGetFocus, aControl, % "ahk_id " hw_TTOTAL_CMD
SendMessage, 0x190, , , % aControl, % "ahk_id " hw_TTOTAL_CMD
CountItems = %ErrorLevel%
SendMessage, 0x187, 0, , % aControl, % "ahk_id " hw_TTOTAL_CMD
UpLevel = %ErrorLevel%

if (( CountItems > 1 ) || ( ( CountItems = 1 ) && ( UpLevel != 1 )))
  SendMessage, 0x433, 2021,,, % "ahk_id " hw_TTOTAL_CMD

ExitApp
I think it available to use LB_GETSELITEMS to get filelist directly without clipboard. But I do not know yet how to make it.
If you speak russsian, you can give a look to TCIMG or ask in russian forum !
Yes, I know the author, he gave some ideas.))
AutoHotKey UI script with Total Commander 64Bit is not very used anymore
Maybe. But I write simple scrips and don't have troubles.
Only problem is different Class names, but we can check is TC 64bit or 32bit, and use the fit Classes.
For example - it's my small script to scroll tabs in 32/64bit TC.
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
Notme
Junior Member
Junior Member
Posts: 14
Joined: 2011-06-02, 09:05 UTC

Re: How to get list of selected files?

Post by *Notme »

Hi.
This is an old thread, but I think it still applies.
How to get the list of ONLY selected files? Just like the OP wrote, if no files are selected the list should be empty.
(That is because if no files are selected, the program I am passing the list to should use the clipboard instead.)
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: How to get list of selected files but ONLY if something IS really selected?

Post by *Stefan2 »

Notme wrote: 2021-04-09, 10:14 UTC
How to get the list of ONLY selected files? Just like the OP wrote, if no files are selected the list should be empty.


F1 > search for "dialog" > Dialog box: Configuration - Change button bar

%Y anywhere in the parameters:
Pass empty list to program when using one of the List parameters like %L and nothing is selected.
Otherwise, the file under the cursor would be passed.







To work with the selected files use TCs parameter like %L, %F or %S or others (see help > F1 > search for "dialog" > Dialog box: Configuration - Change button bar).
If no file is selected, the current file under the cursor would be passed.
If one or more files are selected you get only the selected one.
You can use now the newer %Y paramter to pass an empty list when using one of the above parameters and nothing was selected.

03.05.18 Release Total Commander 9.20 beta 1 (32/64)
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)



 
Notme
Junior Member
Junior Member
Posts: 14
Joined: 2011-06-02, 09:05 UTC

Re: How to get list of selected files?

Post by *Notme »

Duhh.... :roll: how can I have missed that?
Thanks for opening my eyes :lol:
Post Reply