Is there a wait command available

I have a button that executes this series of commands.

"C:\Program Files\File\fn.exe"
runmode hide
SetClip.exe {destpath$|noterm}
ContextMenu FILE ID 113

Is there a wait command available so that after the first command is run, it waits till it is completed before it runs the next command.

Presently, because the commands executes sequentially, without waiting for the command to complete, the last command executes incorrectly because the ContextMenu FILE ID 113 ends up running the wrong Context Menu item because fn.exe is not fully loaded as yet.

And ContextMenu FILE ID 113 is actually supposed to execute a command associate with fn.exe

Alternatively, is there a command that makes DOPUS wait a definable time before executing the next command.

Thanks very much

Put sync: in front of the command that you want Opus to wait for. Eg,

sync:"C:\Program Files\File\fn.exe"

I modified it a little after reading another thread in the forum.

"But sure enough, for some reason... THIS series of commands does what I want:

sync:"C:\Program Files\Monkey's Audio\MAC.exe" {filepath} {filepath|ext=ape} -c5000 -v
sync:"C:\Program Files\Lame\Lame.exe" --alt-preset insane {filepath} {filepath|ext=mp3}"
resource.dopus.com/viewtopic.php ... it&start=0

The modified command is

runmode hide
Sync:"C:\Program Files\File\fn.exe"
runmode hide
SetClip.exe {destpath$|noterm}
ContextMenu FILE ID 113

It however, did not work that consistently.

So I tried

runmode hide
Sync:"C:\Program Files\File\fn.exe"
runmode hide
Sync:"C:\Program Files\File\fn.exe"
runmode hide
SetClip.exe {destpath$|noterm}
ContextMenu FILE ID 113

The idea is that the repeat command
runmode hide
Sync:"C:\Program Files\File\fn.exe"

will ensure the program is loaded. But I still get mixed results.

I guess some sort of

Wait 20 secs would be useful

Any help would be appreciated.

Thanks

I take it it doesn't work if you don't launch FN.exe at all? (Shoudln't the context menu item launch the program if it's not there yet? Seems like a bug in the program to me, as does failing to buffer up context menu commands when the program is starting up.)

Is FN.exe a program with a GUI? If so it will automatically detach from the thing which launches it and there's no standard/reliable way to detect when it is ready.

There is a standard way to wait for a GUI program to terminate, which is what the start command's /WAIT parameter does for example, but there isn't a way to launch a program and wait until it is "ready". The program would have to do something like set a named event which another program could then listen to, but that requires a change to its code.

You might have to use a hack like a fixed delay but that always has the risk that the button won't work one day because things take a bit longer for some reason.

By the way, you only need one "runmode hide" line. It prevents a console window from appearing due to DOS commands (like SetClip.exe) but it affects the whole button, rather than just the next line.