Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBScript script progress notification

Tags:

vbscript

I'm a VBScript novice, writing a script that will be parsing large input file(s) and will likely take several minutes run time to complete processing. I need a way to alert users that the script is running without error during this long processing time. My first thought was to present a msgbox for every 1000th record processed (e.g. "script has successfully processed 1000 records so far.") Haven't quite cracked the proper way to code an incrementer that will conditionally trip a msgbox every Nth record (or determined if there's a better way to achieve my end goal). Any ideas?

like image 663
Underpants Avatar asked Aug 13 '13 17:08

Underpants


1 Answers

In such cases I'd like to use WshShell.Popup method to provide information about the current progress.

Here an example:

Dim WshShell, i
Set WshShell = CreateObject("WScript.Shell")

For i = 1 To 500
    'Do Something
    If i Mod 100 = 0 Then 'inform for every 100 process 
        WshShell.Popup i & " items processed", 1, "Progress" ' show message box for a second and close
    End If
Next
like image 153
Kul-Tigin Avatar answered Oct 22 '22 10:10

Kul-Tigin