This forum uses cookies. Click X button to hide this message. What is stored? 
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can I make a button to run the cmd for all selected files?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Total Commander Forum Index -> Total Commander (English) Printable version
View previous topic :: View next topic  
Author Message
petermad
Power Member
Power Member


Joined: 05 Feb 2003
Posts: 7540
Location: Valsted, Denmark

PostPosted: Thu Apr 12, 2018 5:43 am    Post subject: Reply with quote

2avada
I realized that the reason why it does not work with quotes around the path to the editor is that the Start command then thinks that it is the Title of the program, so a title needs to be added to make it work like here:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do start "BEncode Editor" "E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files in notepad at the same time

1
-1


The second button that uses the call command ind stead of the start command should work as it was:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do call "E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files in notepad one after another

1
-1

_________________
#524
Danish Total Commander Translator
TC 9.12 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit. TC 2.90 on Android 6.0

Get Extended Total Commander Menus
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nsp
Power Member
Power Member


Joined: 04 Dec 2005
Posts: 1162
Location: Lyon (FRANCE)

PostPosted: Fri Apr 13, 2018 2:45 am    Post subject: Reply with quote

avada wrote:
isidro wrote:
if there are spaces on either path or filename you will need to enclose all in ""
You may try first putting and renaming editor in a simpler way (with no spaces/strange chars on name or path) (ie: C:\UT\myeditor.exe)


I know but quotes don't help. And renaming/moving files is not viable, even though it works that way.

With TCBL, you can define into the ini file some "script" and use them from TC.To call an editor for all selected regular files.
inside tcbl.ini (same folder as tool)
Code:
[BEdit]
ini=q
pre=set BEdit="E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe"
cmd=%BEdit% "$f"

And inside Total Commander
Code:
command=<path to>\tcbl.exe
parametters=-i %L BEdit
icon File: <path to BEncode Editor>
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
avada
Member
Member


Joined: 05 Oct 2007
Posts: 183

PostPosted: Sat Apr 14, 2018 8:01 am    Post subject: Reply with quote

petermad wrote:
2avada
I realized that the reason why it does not work with quotes around the path to the editor is that the Start command then thinks that it is the Title of the program, so a title needs to be added to make it work like here:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do start "BEncode Editor" "E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files in notepad at the same time

1
-1


The second button that uses the call command ind stead of the start command should work as it was:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do call "E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files in notepad one after another

1
-1

It still doesn't seem to work.
There seem to be issues with the text you pasted. But even after fixing it it doesn't work:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do start "BEncode Editor" "e:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files in notepad at the same time

1
-1




nsp wrote:
avada wrote:
isidro wrote:
if there are spaces on either path or filename you will need to enclose all in ""
You may try first putting and renaming editor in a simpler way (with no spaces/strange chars on name or path) (ie: C:\UT\myeditor.exe)


I know but quotes don't help. And renaming/moving files is not viable, even though it works that way.

With TCBL, you can define into the ini file some "script" and use them from TC.To call an editor for all selected regular files.
inside tcbl.ini (same folder as tool)
Code:
[BEdit]
ini=q
pre=set BEdit="E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe"
cmd=%BEdit% "$f"

And inside Total Commander
Code:
command=<path to>\tcbl.exe
parametters=-i %L BEdit
icon File: <path to BEncode Editor>


I took a look at TCBL. It seemed a tad complicated. At first I thought it would be a plugin. But it's an external program with it's own separate configuration. It seemed a tad complicated. But it looks like I'll need to start experimenting with it.
_________________
Windows 8.1
Back to top
View user's profile Send private message
petermad
Power Member
Power Member


Joined: 05 Feb 2003
Posts: 7540
Location: Valsted, Denmark

PostPosted: Sat Apr 14, 2018 11:30 am    Post subject: Reply with quote

2avada
You are right that the pasting of "alkalmazások - telepítők" went wrong.

I downloaded two versions of "BEncode Editor.exe" from https://sites.google.com/site/ultimasites/bencode-editor :
[v0.6.1.0] Unicode
[v0.6.1.0] ANSI

If I use the first one (Unicode version) the button works fine, but if I use the second one (ANSI version), the button fails if the path to the editor or the path to the selected file contains for example the ő character.

So maybe you are using an ANSI version of "BEncode Editor.exe" - in that case try the Unicode version in stead.

The button also works with [v0.7.1.0] x64 and [v0.7.1.0] Unicode
_________________
#524
Danish Total Commander Translator
TC 9.12 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit. TC 2.90 on Android 6.0

Get Extended Total Commander Menus
Back to top
View user's profile Send private message Send e-mail Visit poster's website
avada
Member
Member


Joined: 05 Oct 2007
Posts: 183

PostPosted: Sun Apr 15, 2018 6:02 am    Post subject: Reply with quote

petermad wrote:
2avada
You are right that the pasting of "alkalmazások - telepítők" went wrong.

I downloaded two versions of "BEncode Editor.exe" from https://sites.google.com/site/ultimasites/bencode-editor :
[v0.6.1.0] Unicode
[v0.6.1.0] ANSI

If I use the first one (Unicode version) the button works fine, but if I use the second one (ANSI version), the button fails if the path to the editor or the path to the selected file contains for example the ő character.

So maybe you are using an ANSI version of "BEncode Editor.exe" - in that case try the Unicode version in stead.

The button also works with [v0.7.1.0] x64 and [v0.7.1.0] Unicode


I checked the version but it doesn't work with either. No clue what might be wrong

Quote:
You are right that the pasting of "alkalmazások - telepítők" went wrong.

Also the "" characters, right? I have no clue what might be wrong.
_________________
Windows 8.1
Back to top
View user's profile Send private message
petermad
Power Member
Power Member


Joined: 05 Feb 2003
Posts: 7540
Location: Valsted, Denmark

PostPosted: Sun Apr 15, 2018 6:34 am    Post subject: Reply with quote

Quote:
I have no clue what might be wrong

Me neither, here is what I did:

1. I made a directory: "e:\alkalmazások - telepítők\Bittorrent\bencode\"
2. I put the v0.6.1.0 Unicode version of "BEncode Editor.exe" in it
3. I use the button:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WL`) do start "BEncode Editor" "e:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files with BEncode Editor at the same time

1
-1

4. I mark a couple of text files and click the button
5. I see something like this: http://madsenworld.dk/tcmd/bencode.png - which to me shows that the editor launches and open the file alright - the error in line 2 is because I don't have a bittorrent script file to test with.

I have tested this under Windows 7 and 10

What happens if you try? - nothing? - or do you get any error messages, and if so, what are they?
_________________
#524
Danish Total Commander Translator
TC 9.12 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit. TC 2.90 on Android 6.0

Get Extended Total Commander Menus


Last edited by petermad on Sun Apr 15, 2018 6:52 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
petermad
Power Member
Power Member


Joined: 05 Feb 2003
Posts: 7540
Location: Valsted, Denmark

PostPosted: Sun Apr 15, 2018 6:43 am    Post subject: Reply with quote

Quote:
There seem to be issues with the text you pasted. But even after fixing it it doesn't work

Actually - if you copy this:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WL`) do start "BEncode Editor" "e:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files with BEncode Editor at the same time

1
-1

and paste it to the buttonbar (right-click buttonbar, choose Paste) - then TC automatically inserts it correctly (because of the  BOM marker)
_________________
#524
Danish Total Commander Translator
TC 9.12 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit. TC 2.90 on Android 6.0

Get Extended Total Commander Menus
Back to top
View user's profile Send private message Send e-mail Visit poster's website
avada
Member
Member


Joined: 05 Oct 2007
Posts: 183

PostPosted: Mon Apr 16, 2018 10:05 am    Post subject: Reply with quote

petermad wrote:
Quote:
I have no clue what might be wrong

Me neither, here is what I did:

1. I made a directory: "e:\alkalmazások - telepítők\Bittorrent\bencode\"
2. I put the v0.6.1.0 Unicode version of "BEncode Editor.exe" in it
3. I use the button:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WL`) do start "BEncode Editor" "e:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files with BEncode Editor at the same time

1
-1

4. I mark a couple of text files and click the button
5. I see something like this: http://madsenworld.dk/tcmd/bencode.png - which to me shows that the editor launches and open the file alright - the error in line 2 is because I don't have a bittorrent script file to test with.

I have tested this under Windows 7 and 10

What happens if you try? - nothing? - or do you get any error messages, and if so, what are they?


Okay. So I did the same thing, but nothing happens. If the timing is right I see cmd.exe and conhost.exe appearing in Process Explorer, and immediately exiting, so I can't check the command that started them.
_________________
Windows 8.1
Back to top
View user's profile Send private message
petermad
Power Member
Power Member


Joined: 05 Feb 2003
Posts: 7540
Location: Valsted, Denmark

PostPosted: Mon Apr 16, 2018 2:39 pm    Post subject: Reply with quote

2avada

OK - to rule out some causes of error try the button below, but on files that has ONLY English characters in the file name and path:

Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else for %%n in (%L) do start "BEncode Editor" "e:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files with BEncode Editor at the same time

1
-1

_________________
#524
Danish Total Commander Translator
TC 9.12 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit. TC 2.90 on Android 6.0

Get Extended Total Commander Menus
Back to top
View user's profile Send private message Send e-mail Visit poster's website
avada
Member
Member


Joined: 05 Oct 2007
Posts: 183

PostPosted: Wed Apr 18, 2018 10:19 am    Post subject: Reply with quote

petermad wrote:
2avada

OK - to rule out some causes of error try the button below, but on files that has ONLY English characters in the file name and path:

Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else for %%n in (%L) do start "BEncode Editor" "e:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files with BEncode Editor at the same time

1
-1

Doesn't really work. I get one instance opened with some temp file. eg.:
Code:
[18:18:49] [BDecode] Start: "C:\IDEIGLENES\CMDC044.tmp"
[18:18:49] [ERROR] Failed to decode the data

_________________
Windows 8.1
Back to top
View user's profile Send private message
petermad
Power Member
Power Member


Joined: 05 Feb 2003
Posts: 7540
Location: Valsted, Denmark

PostPosted: Wed Apr 18, 2018 10:50 am    Post subject: Reply with quote

Quote:
I get one instance opened with some temp file.

You are right, I removed too much code.

Try this - still only with filenames with all english caracters:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else  for /F "usebackq delims=" %%n in (`type %L`) do start "BEncode Editor" "e:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files with BEncode Editor at the same time

1
-1

_________________
#524
Danish Total Commander Translator
TC 9.12 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit. TC 2.90 on Android 6.0

Get Extended Total Commander Menus
Back to top
View user's profile Send private message Send e-mail Visit poster's website
avada
Member
Member


Joined: 05 Oct 2007
Posts: 183

PostPosted: Sat Apr 21, 2018 2:08 am    Post subject: Reply with quote

petermad wrote:
Quote:
I get one instance opened with some temp file.

You are right, I removed too much code.

Try this - still only with filenames with all english caracters:
Code:
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\* ((echo DO NOT MARK DIRECTORIES!) && (echo.) && pause) else  for /F "usebackq delims=" %%n in (`type %L`) do start "BEncode Editor" "e:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe" "%%n"
wcmicons.dll,28
Open all selected files with BEncode Editor at the same time

1
-1

I figured out what the issue is. I just noticed that there's a chcp in the code, and I vaguely remember that 65001 didn't work for batch files (and I had to use 1250) because of god knows what stupid windows issue.

After making the change the files are opened properly with the program.
_________________
Windows 8.1
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Total Commander (English) All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Imprint/Impressum: This site is maintained by Ghisler Software GmbH
Privacy Policy | Datenschutzerklärung

Using phpBB © 2001-2005 phpBB Group