Preventing Simultaneous Command Execution in Buttons

In Windows batch files I can force commands to be executed one by one by using arguments like && between them, on a single line, or by using START /WAIT to run each on a separate line.

In DOpus buttons, how does one accomplish this? If I am running a command that creates, say, a zip file, and I want to copy that file to another folder, for some reason I get an error from the copy command, since there is no zip yet at the beginning of button execution.

Is there a "wait" or "pause" statement, or a way to use conditionals like "if errorlevel" in DOpus?

Any help is appreciated...

Thanks
Rick Cogley

Hi Rick,

I'm not certain what you're experiencing here.

I use a command processor replacement from JPsoft
called either Take Command, 4NT, or 4Dos.
Unicode versions are also available for demo download. The demos are fully functional.
4Dos is obsolete except for Fat file systems and is now freeware.

I have no difficulty at all writing complex batch file apps,
and not having them execute line by line.
Each line waits for the exit code of the previous line before it executes.
I always thought MS Dos did this too. Does anyone know the real story here?

One exception to this is when dopusrt.exe is used in a
batch file to run a Dopus command. In this case, the batch file will not wait for Dopus to finish.

When using command line programs, I think it has to be one that returns an status bit or exit code to work properly. Perhaps to accomplish what you are attempting to do you need a different zip program.

When I use the && directive, if the first command returns a false exit code,
the second command is not executed as the && statement is already false.
The fact that this works for you seems to indicate that you have an exit code of true.
Does anyone know the real story here?

I would keep DOS commands in the button itself to a minimum.
I would use runmode hide and a call command to a batch file.

Sorry, I still haven't found time to get back to you on our
previous discussion.

                             Sincerely,
                             Tsunami

Edited Afterthought:

A pipe might also be useful.
command1 | command2
This redirects the output of command1 to the input of command2.

Calling yet another batch file can be useful.
It's output can be redirected if needed.
The first batch file then resumes execution at the next line .

Well, what's happening is that the create zip command is running at the same time as the copy command. The copy command ends rather quickly, before the zip command finishes, so you get an error. I need the copy to be dependent on the existence of that zip file.

Jon told me that to prevent DOpus native buttons (i.e. not set in the button as DOS batch but "dopus") from executing all the DOpus commands at once, you put a sync: in front of the line you want to force to finish before the next one is executed. This "sync:" is the batch file equivalent of "start /wait", I guess. I am doing some tests to see how it works.

I'm using NT-based systems - NT, XP, 2000, 2003, with their cmd.exe command processor. I've heard of 4DOS and 4NT but have never tried them.

I'll look at "runmode hide" as well. Thanks for the tip.

Regards
Rick

A followup - It appears that sync: is only for external commands, and the manual implies that as well.

To clarify further, sync: is only needed when mixing internal and external commands.

Not quite, nudel - sync: can be useful even when you only have external commands, if for example you need to run one command on the results of the first command, you would use sync: on the first.

In short, sync: simply tells Opus "wait for this external command to finish before continuing with the rest of the function"