[Gambas-user] Help for observ one process...
Gianluigi
gradobag at gradobag.it
Thu May 18 17:18:24 CEST 2023
Il 18/05/23 14:54, T Lee Davidson ha scritto:
> On 5/18/23 04:18, Fabien TONIUTTI wrote:
>> Hi,
>> A gambas Zip front end project.
>>
>> In one zip file, i have 150 files and folders.
>> I make a zip front end in gambas.
>> When i click on my button 'Expand', i need to know how many file are
>> uncompressed and how many file stay to uncompress with a progressbar.
>> how i could have a progress bar who increase with number of file
>> uncompressed during my process :
>>
>> Exec["unzip",$file]
>>
>> Thanks for your answer.
>
> To track the unzip progress, you would probably need to use `unzip -l`
> first to get the total size of all files. And then do the actual
> decompression verbosely with `unzip -v` in a Process so you can read
> the output in the Process' Read event. Provided the data you need is
> provided by `unzip`, this would allow you to calculate the progress as
> each file is processed.
>
> Take a look at the manual page for "unzip" and possibly "zipinfo" as
> well; and also https://gambaswiki.org/wiki/comp/gb/process.
>
Hi,
Right,
...but only in case a loop was used...
to get the number of zipper files you can use this code:
Dim aZip As String[]
Dim iZipCount, i As Integer
aZip = Dir("~/<your zip folder>", "*.zip", gb.File)
iZipCount = aZip.Count
and if you use a loop with a counter, for the bar you can give:
For i = 0 To aZip.Max
ProgressBar1.Value = i / aZipCount
Next
Regards
Gianluigi
More information about the User
mailing list