Only thing I can see that you might want to change is that the filename stem should be passed through Wild.EscapeString so that any wildcard characters like (
and )
in the filename are interpreted as literal characters instead of as part of a wildcard expression.
So add
var wild = DOpus.FSUtil.NewWild();
near the top, then change
wcard = "*" + stem + "*";
to
wcard = "*" + wild.EscapeString(stem) + "*";
See:
They're synchronous by default, but some programs (most UI programs) will detach themselves unless you explicitly ask to wait for them. Adding @sync:
before the command is usually enough (same as in a non-script button), but Windows Scripting Host also has its own methods to run things which can wait as well, if needed.
(Aside: Please Ask one question per thread )