viewpoint-particle

Author Topic: Progress Bar  (Read 137 times)

jcmn

  • Newbie
  • *
  • Posts: 5
Progress Bar
« on: October 07, 2019, 07:12:47 am »
Hello

I'm new here with this script language.

I would like that someone could give me an example of a script with a progress bar for a copying files task where the progress bar shows the number of files already copied.

Thanks in advance.

jmburton2001

  • Jr. Member
  • **
  • Posts: 59
Re: Progress Bar
« Reply #1 on: October 07, 2019, 07:26:12 am »
I'm a hobbyist so I tend to use the easiest solution.

Look into aStatusBar (Creates a simple "progress-indicator / thermometer bar" with title, text, and the progress indicator).

I use it for all my progress bar applications. Some of them with over 150,000 items. In your application it would be easy to show a progress bar with the name of the file being copied, the number of files already copied, and the number of files left to copy (and maybe even a percentage completion).

EDIT: I have some time today if you'd like some more detailed assistance.

td

  • Tech Support
  • *****
  • Posts: 3079
    • WinBatch
Re: Progress Bar
« Reply #2 on: October 07, 2019, 07:52:20 am »
AStatusBar is likely the best approach in terms of appearance and ease of use.  While not strictly speaking a progress bar, the WinBatch Box functions are roll-your-own approach that allows you to provide the viewer with any information you see fit. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

jcmn

  • Newbie
  • *
  • Posts: 5
Re: Progress Bar
« Reply #3 on: October 07, 2019, 08:07:33 am »
Thanks

I'll try it.

jcmn

  • Newbie
  • *
  • Posts: 5
Re: Progress Bar
« Reply #4 on: October 07, 2019, 08:16:57 am »
I'm a hobbyist so I tend to use the easiest solution.

Look into aStatusBar (Creates a simple "progress-indicator / thermometer bar" with title, text, and the progress indicator).

I use it for all my progress bar applications. Some of them with over 150,000 items. In your application it would be easy to show a progress bar with the name of the file being copied, the number of files already copied, and the number of files left to copy (and maybe even a percentage completion).

EDIT: I have some time today if you'd like some more detailed assistance.

Didn't find anything in help files about aStatusBar , is it a function? a command? an object?

Could you give an example?

jmburton2001

  • Jr. Member
  • **
  • Posts: 59
Re: Progress Bar
« Reply #5 on: October 07, 2019, 08:33:40 am »
It's in the "Consolidated WIL Help" file. Do a search for astatusbar and you'll find it in the "Shell Operations Extender" functions. Example 1 would probably be most appropriate for a file copy operation.

In it's most basic form it works like this:

1. Initialize the status bar

2. Do some work and update the status bar during this work

3. When finished with your work, kill it


td

  • Tech Support
  • *****
  • Posts: 3079
    • WinBatch
Re: Progress Bar
« Reply #6 on: October 07, 2019, 09:27:31 am »
You do need to download and install the Shell Operations extender before the function will appear in the Consolidated WIL Help file.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

jcmn

  • Newbie
  • *
  • Posts: 5
Re: Progress Bar
« Reply #7 on: October 07, 2019, 09:48:25 am »
You do need to download and install the Shell Operations extender before the function will appear in the Consolidated WIL Help file.

OK Got it.

It has also a progress bar dedicated to copying of files.

I don't see in the copyfiles an optins for overwrite of files like for example copy if newer

td

  • Tech Support
  • *****
  • Posts: 3079
    • WinBatch
Re: Progress Bar
« Reply #8 on: October 07, 2019, 10:04:36 am »
Assuming that you are referring to the aFileCopy functions, its primary purpose is not to be used as a status bar.  Its primary purpose is to provide a way to use the Window shell's file copy functionality which is a bit different than a straight file system copy.  You need to use aStatusBar.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

jmburton2001

  • Jr. Member
  • **
  • Posts: 59
Re: Progress Bar
« Reply #9 on: October 07, 2019, 10:15:13 am »
If you would be more forthcoming with what you're trying to do, we could probably give you more accurate help and maybe even some code snippets.

It's hard to give an example if we don't know what you're trying to accomplish. Until then you'll only receive generic answers.

Just to be sure you're up to date, you should probably download and run vcheck. https://www.winbatch.com/download.html

jcmn

  • Newbie
  • *
  • Posts: 5
Re: Progress Bar
« Reply #10 on: October 08, 2019, 01:05:45 am »
Hello again

What I only want at this moment of learning is a code example of the use of the progress bar in a copy operation.

By the way looking at all the options in the extender it seems that in a copy operation there is no option to "overwrite only newer files and skip older ones" when files already exist in the destination.
 Is it true?

Meanwhile eventually I will ask for help as needed when new challenges come up on my work. And there is an heavy one in the horizon that I will take here later.

I'm not completely a rookie in this kind of programming, years ago I made  a lot of programming with AUTOIT language that have some similarities with WINBATCH. I decided to try WINBATCH because it has a complete set of tools to help in the programming, like the Dialog Editor.

And to finish this reply I already made a dialog with buttons to run applications and files for a daily use.



td

  • Tech Support
  • *****
  • Posts: 3079
    • WinBatch
Re: Progress Bar
« Reply #11 on: October 08, 2019, 07:34:57 am »
By the way looking at all the options in the extender it seems that in a copy operation there is no option to "overwrite only newer files and skip older ones" when files already exist in the destination.
 Is it true?

No, the extenders aFileCopy function does not have an option to "overwrite only newer files and skip older ones".  You don't need to have the extender perform the file copy. You just need to use the aStatusBar function to display a status bar.  You can use the FileCopy or FileMove functions to perform the actual file movement.  You can also use the FileTimeCode, FileTimeGet, or FileTimeGetEx function to check file times.

There are examples for each function in the help file and more examples in the Tech Database.  It is a fairly straight forward process to stitch these functions together in the way you prefer to perform your task.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade