Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBScript help Progress bar

Posted on 2009-05-12
5
Medium Priority
?
1,270 Views
Last Modified: 2012-06-22
I'm hoping someone can help us with this.  We have a VBScript in place that I have some of our student tachs use to clean systems of old user profiles, disk cleanup etc.  What I would like to have is, a progress bar running within the script so they can tell that it is actually running and how far along it is.  What is happening is they are running the script and becase no prog bar is showing on the screen they end up runnng it again and again and errors occur.  I'm kinda new here so if I'm not posting correctly please let me know.  Thanks in advance.
0
Comment
Question by:pain995
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
Kamaraj Subramanian earned 2000 total points
ID: 24363895
http://www.tpfsoftware.com/webhelp/products/scriptdialogs10/progress_vbscript_example.htm
Sub main
  ' Create the progress dialog box
  Set ProgressDialog = CreateObject("TPFSoftware.ProgressDialog")
 
 
 ' Set the caption (the title) of the
  ' Progress dialog box.
  ProgressDialog.Caption = "My Progress"
 
 
 ' Set the minimum value of the progress bar.
  ProgressDialog.Min = 0
 
 
 ' Set the initial position while the dialog box is not
  ' yet open, in case the dialog box
  ' was used previously and the position was not reset.
  Position = 0
  ProgressDialog.Position = Position
 
 
 ' Set the maximum value of the progress bar.
  Max = 5
  ProgressDialog.Max = Max
 
 
 ' This is the number of seconds to delay when
  ' simulating work. Your real script will not 
  ' need this.
  DelaySeconds = 2
 
 
 ' Display the progress dialog box
  ProgressDialog.Open
 
 
 ' This While Loop simulates doing the work.
  While Position < Max
    ' Update the progress message
    ProgressDialog.Message = "Performing step " & (Position + 1)
 
 
   ' A delay to simulate work being done
    wait_function(DelaySeconds)
 
 
   ' Work has been done. Update the progress
    ' position.
    Position = Position + 1
    ProgressDialog.Position = Position
  Wend
 
 
 ' Update the progress message to tell them we
  ' finished.
  ProgressDialog.Message = "All steps completed!"
 
 
 ' I inserted a short delay here so we could see
  ' the progress bar at 100 percent and also read
  ' the message.
  wait_function(1)
 
 
 ' Close the progress dialog box. If the entire 
  ' script is over at this point, you don't have 
  ' to call this.
  ProgressDialog.Close
End Sub
 
 
' ----------------------------------------------------
' This is a delay function I got from the Internet
' This example uses this function to provide a 
' delay that simulates some real work being done.
' ----------------------------------------------------
Private Sub wait_function(secs)
  Dim enter_time, leave_time
  enter_time = Timer
  leave_time = Timer
  While (enter_time + secs > leave_time)
    leave_time = Timer
  Wend
End Sub

Open in new window

0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24364292
Couldn't you just add a

   MsgBox "Done"

to the end of your script?
0
 

Author Comment

by:pain995
ID: 24364368
kaufmed:
The problem with that is if nothing visually shows that it is actually doing something when there is a lot of profiles etc being deleted and the extended time it takes to complete they asume maybe its not working and just attempt to run it again.

Testing solutions provided in a just a bit

Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question