Hi,
I'm trying to let myself know that the app I'm creating is in fact doing something long-winded / is not stalled - and I came up with both the busy indicator and the progress bar. Generally simple stuff but I'm now lost'... again !
Both the busy indicator and the progress bar work when the engine isn't completely tied up... by that I mean, for example, transferring multiple files from one place to another or deleting multiple files. In both cases I use a repeat structure and insert a 'wait 0 milliseconds with messages' command within the repeat structure (between each transfer or delete operation) to ensure that any waiting messages (like updating a 'progress bar') are handled. The end result is that I see something going on whilst a long-winded process is 'hogging' resources... All well and good... until...
One of my files is a ZIP file (created by my app with a progress bar), all well and good. Once the ZIP file is created it can be optionally copied to some other location.
The ZIP file (today) has exceeded 200MB in size (contains multiple picture images etc) and during the copy process (which can take up to 40 seconds) I note the busy indicator / progress bar stalls / halts for the duration of the copy... which can cause concern... and my Android ICS device to produce a warning "...stopped responding' message... Yuch - ugly !
So, to my question :
Is there a way to copy a large (in my case ZIP) file from one place to another whilst having a progress bar / busy indicator update ? I did see somewhere that with a text file one can (effectively) use a repeat structure to copy chunks (say 1KB) of data from a large file to a new location until an 'EOF' is encountered...
Can one do this with a ZIP file and is there an example - I can't find where I found this method / example in the past...
Thanks a mil. Much appreciated.
Regards
Trax
Progress Bars
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Progress Bars
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: Progress Bars
Hi Trax,
since a ZIP file is just binary data, you can use the long "open file xyz" syntax.
Don't have the correct syntax at hand so I will use a mixture of real and pseudocode, but you get the picture
Best
Klaus
since a ZIP file is just binary data, you can use the long "open file xyz" syntax.
Don't have the correct syntax at hand so I will use a mixture of real and pseudocode, but you get the picture
Code: Select all
...
put "path to/sourcefile.zip" into tSource
put "path to/destinationfile.zip" into tDest
open file tSource for binary read
open file tDest for binary write
## Now read and write small chuncks of data:
repeat until EOF --???
## Not sure if that is correct, please check the dictionary :-)
read from file tSource for X
## where X is the number of chars/bytes you want "copy" to tDest
write IT to file tDest
## Update your progressbar here and now
end repeat
close file tSource
close file tDest
...
Klaus
Re: Progress Bars
Thanks Klaus,
Would you happen to know whether this method work for ANY file type/extension or are there limitations ?
Once again, thanks a million - really appreciated.
Would you happen to know whether this method work for ANY file type/extension or are there limitations ?
Once again, thanks a million - really appreciated.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: Progress Bars
Hi Trax,
that will work for ANY filetype!
But use "... for text read" etc. when accessing text files.
Best
Klaus
that will work for ANY filetype!
But use "... for text read" etc. when accessing text files.
Best
Klaus
Re: Progress Bars
Thanks a million Klaus. Much appreciated.
Regards.
Trax
Regards.
Trax
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1