Running an external executable within a DOpus command

hello.

can you help? I'm trying to run an external command in opus and it doesn;t work - but it flashes up and disappears so quick it's hard to work out what the problem is.

this is probably not much use but this is my command:

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe" "{filepath}" /c /l:VB /out:"{sourcepath}"

Thought I'd try this to see if it was at least finding my initial executable so i ran this from the command prompt:

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe" > "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\test.txt"

This works. I get the default 'help' output of the executable in my text file in the location specified. However if I run this from a DOpus command I get nothing except a quick flash of the DOS command window.

Any ideas?

Cheers,

Ben

Make sure the command's type is set to MS-DOS Batch Function and add a pause command to the last line. That way you can see what the output was without the window closing immediately.

If you want to see what command-line is being generated, stick an echo at the start of it to print the line instead of executing it. There's also the DopTest tool by Tanis which works better than echo for some things, like checking for quotes, and I think also means you don't need the pause command.

Ahh, super. That helped a lot and it's almost working, except I'm struggling with getting just the path of my selected file (without the trailing space) - {sourcepath} is the closest but still has the trailing "".

I checked the help and the forum but didn't have any luck. :frowning:

Any ideas?

Ben

Hi BenBenBenBenBen,

I'm not quite certain what you mean.

If you're just looking for {sourcepath} without the trailing '' character, it's {sourcepath|noterm} .
This returns a sourcepath in the form C:\folder or C:\folder1\folder2 instead of C:\folder\ or C:\folder1\folder2\ .
A drive letter root path, such as C:\ , will still contain the '' though.

Regards,
Porcupine

The answer is somewhat hidden in the 8.2 update PDF:

Function path directives like {sourcepath} can now take an optional 'noterm' modifier, to strip trailing path termination. E.g., {sourcepath|noterm} would return "C:\Test Dir" instead of "C:\Test Dir".

Edit: Oops, posted at the same time as Porc's reply.

Thanks all, that did the trick. All working now.