[Gambas-user] Grabbing certain data from a stream, help a newb

Fabien Bodard gambas.fr at ...626...
Sun Jan 6 00:25:33 CET 2008


Le Saturday 05 January 2008 21:43:05 lawrence pires, vous avez écrit :
> Hi All,
>
> I only recently found Gambas, but I got to say its amazing & addictive.
>
> This is what I have at the moment:
>
> EXEC [dvdmovie, Textbox1.Text] FOR READ AS "Contents"
>
 PUBLIC SUB Contents_Read()

 DIM sLine AS String
dim aString as String[]
READ #LAST, sLine, Lof(LAST)
aString = Scan(sLine, "Pos: *s *f ( *%) *fps*")
if aString.Count > 2 then 
	ProgressBar1.Value = Val(aString[2])/100
endif
END

http://gambasdoc.org/help/lang/scan
>
> & this is stream written to test88
>
> VDec: vo config request - 616 x 252 (preferred colorspace: Planar YV12)
> VDec: using Planar YV12 as output csp (no 0)
> Movie-Aspect is 2.44:1 - prescaling to correct movie aspect.
> videocodec: libavcodec (720x576 fourcc=3267706d [mpg2])
> Pos:   0.0s      1f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
> Writing header...
> INITV: 0.200, 0.160, fps: 25.000
> Pos:   0.1s      2f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.004 [0:0]
> Pos:   0.1s      3f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.008 [0:0]
>
>
> the output from the shell is directed to the test88 file creating a new
> line every time.
>
> 'Pos:   0.1s      3f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.008 [0:0'
>
> Now I need to grab the percentage (0%) this will change as the exec command
> completes the process,
>
> The only command I can find close is Split, to spilt the string/stream, but
> this creates a massive array, so i dont think this is a good path to take,
> (What do you think?).
>
> The reason why I want to grab the percentage is so that I can correctly
> setup the progress bar, Im thinking that the only way the progress bar will
> be correct in showing the progress of the exec command is to grab the
> percentage of completion from the stream, somehow convert the string into
> an integer and then do something like this
>
> ProgressBar1.Visible = TRUE
> ProgressBar1.Value += PERCENTAGE FROM STREAM
> ProgressBar1.Refresh
>
>
> ***The only reason im writing to file atm is so that I can debug, I would
> like to do this on the fly really.
>
>
> Has anyone got any ideas or tips?, how would you do it?, Am I going in the
> right direction?, im totally lost at spitting the stream, getting the right
> bit and then changing a string to an integer so I can use it for the
> progress bar? any help would be amazing
>
> Thanks 2 Gamabs
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list