On 01/24/2013 12:59 PM, John Rose wrote:
> I have written a GUI to execute a command which involves selecting
> filenames (e.g. sCombinedPath below) to be used in a Shell command (as part
> of a Process). It works OK generally. However, if any filename includes a
> quote, it goes wrong.
> sCommand = "mplex -f 8 -o " & "'" & sCombinedPath & "' " &
> ...
>   hProcess = Shell sCommand

If you use Exec (which is not the same as Unix exec()), you can eliminate
quoting altogether.

http://gambasdoc.org/help/lang/exec

It takes an array, not a single string, and there's no shell redirection
because it doesn't invoke a shell. But you can just ignore the Read events
the process raises, and handle writing the log file (or doing something
fancier, I can't remember whether mplex provides useful progress
notifications and I don't seem to have any mpeg streams around that are old
enough for it to handle... ffmpeg definitely does, though) in the Error
event handler. So in your case it would be something like:

Dim mplex as Process
mplex = Exec [ "mplex", "-f", "8", "-o ", sCombinedPath, sVideoPath,
sAudioPath ]

Public Sub mplex_Error(output)
        ' append output to the log file, or parse it for use in a progress bar 
or
whatever
End

I haven't tested this code, but you get the idea.

Rob


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to