System progress bar
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
System progress bar
Hi Everyone (again!)
I have a quasi installer stack which simply asks the user to select a location for a folder and then my script copies the folder from the cdrom into that location.
It all works fine however since the folder is around 350Mb, I wondered if its possible to get a copy progress bar up to show the user that something is happening. Is this possible as an OS thing or do I need to build a card with a progress bar?
My script at the moment is as follows:
On mouseUp
answer folder "Please select a location to save the folder to."
if it is empty then exit mouseUp
put it into tDestinationFolder
revCopyFolder "/folder",tDestinationFolder
pass mouseUp
end mouseUp
Thanks as always
I have a quasi installer stack which simply asks the user to select a location for a folder and then my script copies the folder from the cdrom into that location.
It all works fine however since the folder is around 350Mb, I wondered if its possible to get a copy progress bar up to show the user that something is happening. Is this possible as an OS thing or do I need to build a card with a progress bar?
My script at the moment is as follows:
On mouseUp
answer folder "Please select a location to save the folder to."
if it is empty then exit mouseUp
put it into tDestinationFolder
revCopyFolder "/folder",tDestinationFolder
pass mouseUp
end mouseUp
Thanks as always
-
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
Hi Stormy1,
That would require some time. You need time to code it so that it copies the files one by one into a destination folder and not the whole folder being copied altogether. That way, you can set the endValue property of your loading bar to the number of files that needs to be "installed". Then every time a file gets copied, you simply add 1 to the current thumbPos property of your loading bar.
That would require some time. You need time to code it so that it copies the files one by one into a destination folder and not the whole folder being copied altogether. That way, you can set the endValue property of your loading bar to the number of files that needs to be "installed". Then every time a file gets copied, you simply add 1 to the current thumbPos property of your loading bar.
Thanks shadowslash
But isn't there a way to tell Windows and MacOS to show its own progress bar as it would any copying of folders normally?
If the revCopyFolder is able to copy all the files and subfolders within it without having to specify every file, can't this drive a progress bar itself?
Thanks
But isn't there a way to tell Windows and MacOS to show its own progress bar as it would any copying of folders normally?
If the revCopyFolder is able to copy all the files and subfolders within it without having to specify every file, can't this drive a progress bar itself?
Thanks
-
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
For Windows I think you may need to hook to a system DLL to do that. I'm not just certain which it should be. For Mac, I got no idea.since I don't have it yet.Stormy1 wrote:Thanks shadowslash
But isn't there a way to tell Windows and MacOS to show its own progress bar as it would any copying of folders normally?
If the revCopyFolder is able to copy all the files and subfolders within it without having to specify every file, can't this drive a progress bar itself?
Thanks
Hiya
Could someone let me know where I should look in order to get Revolution to provide a copy progress for what I'm trying to do?
The user has two folders on a cdrom. I have a little stack installer (autoruns from the cdrom) which asks them for the destination and then via revCopyFolder, it copies either folder to the location. This all works fine.
However, since the folders are around 200Mb each, it would be great to have a progress bar showing that the machine is doing something!
I know it involves a repeat of some kind and thumbPos but can't find anything in the documentation as to how to do this.
Many thanks
Could someone let me know where I should look in order to get Revolution to provide a copy progress for what I'm trying to do?
The user has two folders on a cdrom. I have a little stack installer (autoruns from the cdrom) which asks them for the destination and then via revCopyFolder, it copies either folder to the location. This all works fine.
However, since the folders are around 200Mb each, it would be great to have a progress bar showing that the machine is doing something!
I know it involves a repeat of some kind and thumbPos but can't find anything in the documentation as to how to do this.
Many thanks
Hi Stormy,
I have created an installer with all features one would expect from such an installer, including a progress bar to indicate the amount of files copied.
I ditched the revCopyFile and revCopyFolder commands, because they block Revolution entirely. As soon as you call one of these commands, Revolution stays unresponsive until it finsihes copying.
Instead, you should use a repeat loop, which copies parts of the files, e.g. one MB at a time.
Create a scrollbar, set the startValue to 0 and the endValue to 100.
First, calculate the total file size from the detailed files (see docs). Then use a variable to count how many data have been read and set this to 0. Read the first chunk, write it to the destination, update the counter and calculate progress in %. Set the thumbPos of the progress bar to the percentage value. Read the next chunk, write it, update counter, update progress bar, et cetera, until you have read the entire file.
You could use another progress bar to display the number if files that have been copies already. You might want to disregard the first progress bar for files smaller than a few KB, to speed up the process. Make sure no to update the progress bar if the percent value isn't different, because redrawing the progress bar takes time.
Best,
Mark
I have created an installer with all features one would expect from such an installer, including a progress bar to indicate the amount of files copied.
I ditched the revCopyFile and revCopyFolder commands, because they block Revolution entirely. As soon as you call one of these commands, Revolution stays unresponsive until it finsihes copying.
Instead, you should use a repeat loop, which copies parts of the files, e.g. one MB at a time.
Create a scrollbar, set the startValue to 0 and the endValue to 100.
First, calculate the total file size from the detailed files (see docs). Then use a variable to count how many data have been read and set this to 0. Read the first chunk, write it to the destination, update the counter and calculate progress in %. Set the thumbPos of the progress bar to the percentage value. Read the next chunk, write it, update counter, update progress bar, et cetera, until you have read the entire file.
You could use another progress bar to display the number if files that have been copies already. You might want to disregard the first progress bar for files smaller than a few KB, to speed up the process. Make sure no to update the progress bar if the percent value isn't different, because redrawing the progress bar takes time.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Hi Mark
Can I not say... if the revCopyFolder is done, show a window?
I tried this:
if revCopyFolder is done then
answer "The folder has finished copying" with "OK"
if it is "OK" then quit
end if
Didn't work though although I didn't get any script errors.
So in other words, could I get round this by bring up a window once revCopyFolder is finished?
Thanks
Can I not say... if the revCopyFolder is done, show a window?
I tried this:
if revCopyFolder is done then
answer "The folder has finished copying" with "OK"
if it is "OK" then quit
end if
Didn't work though although I didn't get any script errors.
So in other words, could I get round this by bring up a window once revCopyFolder is finished?
Thanks
Hi Stormy1,
That doesn't make sense. A user isn't interested in knowing when something is done, but in whether he's waiting because the computer is still copying or because the software has crashed. You need to show something alive on the screen while your script is still copying.
If you try to follow my instructions in my earlier post, you can just let me know where you get stuck.
Best,
Mark
That doesn't make sense. A user isn't interested in knowing when something is done, but in whether he's waiting because the computer is still copying or because the software has crashed. You need to show something alive on the screen while your script is still copying.
If you try to follow my instructions in my earlier post, you can just let me know where you get stuck.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
If you want to get away without showing a progress meter as suggested by Mark (which is the best way) then you could always just fudge a method of letting the user know that work is in progress as in something like:If the (Windows) hourglass appears for a long time, with no other indication of progress/activity though, a typical user thinks that it has stopped and needs to be clicked on again, or has crashed and will exit. So a "proper" progress meter is best.
Code: Select all
set the visible of image "PleaseWaitAnimatedGif" to true
lock cursor
set the cursor to watch
revCopyFolder tSourcePath,tDestinationPath
set the visible of image "PleaseWaitAnimatedGif" to false
answer "done"
unlock cursor