I want to run a command that opens a blocking window, but since that window won't come to focus (and thus come out in front of all other windows) I'd like to tell it to do that.
However if I run :
<blocking command> & <command to request focus>
<rest of script>
this runs in parallel i.e. the <command to request focus>
will execute without waiting for <blocking command>
and then <rest of script>
will immediately run.
This is bad for me because it looses the blocking effect. This is important to me, as the blocking command holds a temporary file which I need to delete in <rest of script>
after <blocking command>
has released it).
I tried to marry the following two approaches :
Script to request focus which is composed of three subcommands (and I do not want this in a separate file because some of these subcommands depend on the value of local variables)
Script to launch two commands in parallel and wait on all which offers to run a block in parentheses of
start
commands and waits on the end of the block.( start qtcreator.exe -block "$tmp" start echo (new ActiveXObject("WScript.Shell")).AppActivate("$tmp"); > focus.js ; cscript //nologo focus.js ; del focus.js ) set -P "=" rm "$tmp";
The problem is I think : 1. is composed of multiple commands and 2. uses start
: and it seems that start
is supremely unhappy with multiple commands (indeed, it is hard to parse out when another command that start
needs to run begins, or when the start
command itself is finished).
I am also fully aware that when running in parallel, nothing promises me that my app will have opened its window as per the first command before window focus is requested as per the second command, but this is okay in my use case, and at worst I can implement a small waiting thing. I just want to know how to run those two things in parallel if they are more than just single commands, in a way that does not require of me to have batch files every where that are called (to hide the complexity).
Any suggestions ? Either for a command that nicely does both (open my blocking window and requests focus) or on how to run two commands in parallel ?