Sequencing actions

I have a command button (pretty obvious):

C:\Programy\md5sum\md5sum.exe {file$} > {file$|noext}.md5

Is there a way to force Opus to run the program synchronously, ie. wait after each file for command completion? Currently md5sum is run at the same time multiple times (once for each selected file), which is obviously a bad idea.

Add @sync: to the start of the line, or set the button type to MS-DOS Batch Mode (which you may need to do anyway for the > redirect to work).

This is interesing, if I do so, some trash data is added at the beginning of the data output by md5sum. :question:

Presumably the same happens if you run it from a DOS prompt, outside of Opus? If so it's a question for whoever writes MD5Sum.

It could be a UTF BOM, perhaps (in which case it'd be a question for whatever you're using to view the file as it should understand UTF BOMs).

It happens only if button is set to MS-DOS mode, see the image.

Did you try it from a DOS prompt? (i.e. Start -> Command Prompt)

Oh yes, of course. Both printing output to screen and redirecting to file works OK.

I got md5sum from here and tried it in an MS-DOS button. Seems to work fine.

Are you running it on filenames with non-Latin characters? They could complicate things, perhaps.

Have a dig in your temp folder and see if you can find the .bat file Opus is generating for the button. (It should stay around for a minute or two after the button is run before Opus cleans it up.)


Corruption (for the first file only if I select mutiple files) is caused by the

chcp 1250 > nul

line in .bat file.

When I run the file created by DO from the command line, I get the same problem. When I REM the line, problem goes away.

Try adding one of these lines to the top of the button's command:

@codepage 850


@codepage 1250

Or open a command prompt and type chcp on its own to see what your machine's default codepage for DOS is.

I still can't reproduce the problem on my machine, even when using 1250, but it could be something that's fixed in Windows after XP, or maybe I've got a different version of md5sum.exe.

The DOS codepage does define which codepage is used to redirect program output into text files, so it's certainly involved here, but I can't think of any (sane) reason why it would result in a large amount of garbage being inserted into the file. That seems like a bug somewhere, and not in Opus since you've seen it happen when just running the .bat file. Strange!

Adding @codepage 852 (my default cp) solved the problem.
It must be some OS language-specific problem.
Anyway, default codepage written in DO batch could be the system's default cp, not the 1250 one.

It does use the system's default codepage; and since 1250 is ANSI Central European; Central European (Windows) this would seem to be correct for Poland?

It uses the codepage of the dopus.exe process but for some reason that seems different from the codepage used by default in a command prompt (1252 vs 850 for me and 1250 vs 852 for Xyzzy).

Not sure what the 'right' thing to do is, though. Aside from this issue (which is surely a bug in something other than Opus), using a codepage consistent with dopus.exe means the filenames it puts in the .bat file are more likely to work correctly without translation issues, I would've thought. I don't understand why the command prompt and UI programs are getting different codepages though... Perhaps there's a reason.

Under this link I found the sentence:

Apparently the command prompt uses a different code page than do GUI programs[...]

So, maybe the OEM codepage should be used for batch scripts?

That pages makes sense, but I think it reinforces what Opus is doing.

If batch scripts were left using the the default DOS/OEM codepage then their output would not look correct in GUI tools (e.g. notepad, like in the examples on the page).

Are you using the same version of md5sum.exe? I just tried it on XP SP3, with chcp 1252, and a .bat file that ran it against two files, and it worked okay.

MD5 of the file (pun intended) is:
487d10551dd835a00c983543dcdf0a31 *md5sum.exe
It reports itself as:

C:\Programy\md5sum>md5sum.exe --version md5sum (GNU textutils) 2.0 Written by Ulrich Drepper.

The rest of the message:
So it's another exe, but seems to be newer.