This is a clear example:
Then I comment further improvement of the "converter .ogv . Avi", was produced by a forum member razaAztk gambas-es.org.
It's about putting a bar indicating the status of the conversion, which is useful to know how much time remains to complete the conversion.
Comment a bit as it has managed to:
Has created a process as follows:
hproc = EXEC ["mencoder", TextBoxentrada.text, "-ovc", "xvid", "-oac", "mp3lame", "-xvidencopts", "pass=1", "-o", TextBoxsalida.text] FOR READ AS "Mencorder"
So each time you send something to the process standard output, the event is thrown Mencorder_Read ()
With this subroutine, read every time there is an exit in the terminal:
PUBLIC SUB Mencorder_Read()And analyzing the output is generated by the terminal EXEC (READ #LAST, slin, -50). read a few characters (in this case 50)
DIM sLine AS String
DIM sCad AS String[]
DIM vx AS Float
READ #LAST, sLine, -50
'PRINT sLine
sLine = Trim(sLine)
IF sLine LIKE "*[0-9]*%*" THEN
sCad = Split(sLine, " ", "'", TRUE)
TRY vx = Val(Replace$(Replace$(Replace$(sCad[3], "%", ""), "(", ""), ")", "")) / 100
IF vx > 0 THEN
pb.Value = vx
ENDIF
ENDIF
END
Each line is launching the Read event, the lines that interest us for the progress bar are of the type:
So when you find a number with percentage in the line being analyzed ( IF sLine LIKE "*[0-9]*%*" THEN).
vx = Val(Replace$(Replace$(Replace$(sCad[3], "%", ""), "(", ""), ")", "")) / 100
And take the field 4 (scad [3] (remember that arrays start with 0, so there is 4), which is the (84%). We remove the excess characters (%) and we had a number.This number is going to pb.value (the progress bar), and so he shows how it is developing the process.
This code is very useful as knowing the output terminal generating a command executed by the EXEC command, may be essential for the successful implementation of our program.
Imagine for example that mencoder is not installed on your computer, we can alert the user that has that "we found that mencoder is not installed" ... something that no doubt will be very useful.
Download links:
http://proyectojulio.googlecode.com/files/ogvavi-0.0.2.tar.gz
http://proyectojulio.googlecode.com/files/ogvavi_0.0.2.deb
Greetings and thanks to cooperate with your knowledge of this project razaAztk