How to create a button action for each file selected?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
dbaugh
Junior Member
Junior Member
Posts: 4
Joined: 2005-01-25, 23:43 UTC

How to create a button action for each file selected?

Post by *dbaugh »

I've created a button in the button bar and it works fine for a single file, but when I select multiple files using the right mouse button and then click the button in the button bar, it only does the button action on the last file that I selected. Is there a way to do the button action on each file?

The example button for notepad.exe is a good example for this. The command is "notepad.exe". The parameters are "?%P%N". I select 2 text files in my source window and click the notepad button and it only edits the last file I selected. I want to tell Total Commander that when I click on the notepad button, it should run notepad.exe for each of the text files I have selected. So, if I select 2 text files and click the notepad button, it will edit the first file. When I quit notepad for the first file, Total Commander will edit the second file I had selected, etc.

Can this be done?

Thanks,
Dave
mirkocosta
Junior Member
Junior Member
Posts: 3
Joined: 2005-04-26, 10:15 UTC

Post by *mirkocosta »

Hi
dont u tried an external app called lst2run? I use it to pack multiple files with upx

search 'lst2run' with google
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

@dbaugh:
You have to use parameter %L but this will only work for programs that support transfering files as a file list, like UltraEdit, WinRAR, etc...

For programs like Notepad you need List2multiInstance.
It starts a separate notepad instance for each file in the list and it's very powerful, you can even use regular expressions and save templates.

For programs like Winamp which expect the files to be transfered in one command line use List2str.
An alternative for that would be the excellent Choice Editor, which can be used to open all marked files with different programs after pressing F4.

The afore mentioned lst2run from mirkocosta uses a really crappy syntax, try it out yourself, you will see when you compare with List2multiInstance. For easy stuff like starting notepad it still can do its job of course.

Icfu
This account is for sale
dbaugh
Junior Member
Junior Member
Posts: 4
Joined: 2005-01-25, 23:43 UTC

Post by *dbaugh »

Thanks! I will try this when I get home tonight! I'm sure it will work now!
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Regarding lst2str see this thread, too:
http://www.ghisler.ch/board/viewtopic.php?t=7028

Icfu
This account is for sale
Post Reply