Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Colourfull Progress bar

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,40601
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Colourfull Progress bar
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Colourfull Progress bar - 12/7/2006 4:16:59 PM   
  anoop_pv7

 

Posts: 12
Score: 0
Joined: 7/30/2006
Status: offline
This is a little colorfull progress bar that i managed to develop using VBScript and HTA.

Its pretty much self-explanatory :: The various HTA values are set and scripts are called when the window is loaded (initialise the progress bar),a timer to set the progress bar at specified intervals and to close the window.
To close the progress bar, hit the "Esc" key at any time. Else the HTA terminates as soon as the progress bar reaches the end.

Enjoy!!!

<html>
<head>
 <title>
  Please Wait...
 </title>
 
 <HTA:APPLICATION
  ID="objNoTitleBar"
  APPLICATIONNAME="Please Wait..."
  SCROLL="no"
  SINGLEINSTANCE="yes"
  CAPTION="no"
  BORDER="Thin"
  BORDERSTYLE="complex"
  SHOWINTASKBAR="no"
  CONTEXTMENU="no" 
 >
</head>
<SCRIPT LANGUAGE="VBScript">
 Dim iTimerID
 
    Sub CloseWindow
  if window.event.keyCode = 27 Then
   self.close
  End if
    End Sub
  
 Sub Window_Onload
  iTimerID = window.setInterval("Display_Progress", 200)
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
        For Each objItem in colItems
            intHorizontal = objItem.ScreenWidth
            intVertical = objItem.ScreenHeight
        Next
        intLeft = (intHorizontal - 430) / 2
        intTop = (intVertical - 60) / 2
        window.resizeTo 430,60
        window.moveTo intLeft, intTop
        call Display_Progress
    End Sub
   
    Sub Display_Progress
     If ProgressBar1.Value = ProgressBar1.Max Then
      window.clearInterval(iTimerID)
      self.close
     Else
      ProgressBar1.Value = ProgressBar1.Value + 1
     End if
    End Sub
</SCRIPT>
<body onkeypress='CloseWindow'
 STYLE="font:14 pt arial; color:white;
 filter:progid:DXImageTransform.Microsoft.Gradient
 (GradientType=1, StartColorStr='#FF0000', EndColorStr='#00FF00')"
>
 <object classid="clsid:35053A22-8589-11D1-B16A-00C0F0283628" id="ProgressBar1" height="20" width="400">
     <param name="Min" value="0">
     <param name="Max" value="100">
     <param name="Orientation" value="0">
     <param name="Scrolling" value="1">
 </object>
</body>

</html>
 
 
Post #: 1
 
 RE: Colourfull Progress bar - 12/28/2007 7:30:17 AM   
  morpheus83uk

 

Posts: 274
Score: 0
Joined: 8/21/2006
Status: offline
Quite possibly the wolds most stupid question here but if I were to have this in in application somewhere (with your permission of course) how would i go about getting it to loads and running the scripts etc... I have never delt with HTML or HTA so any help would be much appreciated. or a general shove in the right Direction...

Also when running it I get a type mismatch error on Line 40 Char 9 Which is:

       window.moveTo intLeft, intTop

Any ideas?

Many Thanks

James

(in reply to anoop_pv7)
 
 
Revisions: 1 | Post #: 2
 
 RE: Colourfull Progress bar - 12/28/2007 9:59:44 AM   
  Meg


Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
I tried it on my system and got the same error too.
Even though we all probably only have one monitor, in system device manager my computer has two video adaptors, so when I run the script it reads the monitor dimentions and then reads the second monitor which is zero.

Under line
intVertical = objItem.ScreenHeight

Add this
if intHorizontal<>"" then exit for

Obvoiusly it's personal taste and depends on what your progress bar is monitoring but here is a different colour scheme that looks cool.
(GradientType=1, StartColorStr='#000000', EndColorStr='#FF0000')"

Happy HTA scripting.

           

(in reply to morpheus83uk)
 
 
Post #: 3
 
 RE: Colourfull Progress bar - 12/28/2007 10:43:22 AM   
  morpheus83uk

 

Posts: 274
Score: 0
Joined: 8/21/2006
Status: offline
Thanks for that it works perfectly fine now..

How would I use this for some of my scripts (With the developers permission of course)?

Many Thanks

James 

(in reply to Meg)
 
 
Post #: 4
 
 RE: Colourfull Progress bar - 12/28/2007 10:53:39 AM   
  Meg


Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
Thats funny I am not sure?

Maybe call it as a sub or launch it as a new HTA from an existing HTA.

Or maybe just run it from a plain vbs script with a wait for completed switch?

(in reply to morpheus83uk)
 
 
Post #: 5
 
 RE: Colourfull Progress bar - 12/28/2007 9:07:27 PM   
  morpheus83uk

 

Posts: 274
Score: 0
Joined: 8/21/2006
Status: offline
See I like to pose these little questions :)

The question comes from my thinking of how would the progress bar know how long based on how it was run? So like any progress bar it seems to progress along based on how long its being run for as an estimate... how would this one know how long it has left? as it seems to have a timeout period from what I can gather...

(in reply to Meg)
 
 
Post #: 6
 
 RE: Colourfull Progress bar - 12/28/2007 9:28:03 PM   
  Meg


Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
This post may give you ideas,
http://www.visualbasicscript.com/m_41561/tm.htm

Scripting guy talks about it too.
http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar05/hey0316.mspx

Hope that helps.


This script seems pretty basic, maybe you can get it to loop, ie keep on repeating just to show that your script is still running and not hung?

(in reply to morpheus83uk)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Colourfull Progress bar Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts