VBS  VBA Word  VBA Excel  VBA Access  VB 6.0  Registry key  Java Script  CMD  ASP 
 

  
Add Template to rightclick
AddGlobalGroupToLocal
AddToLocalAdm
AddWindowsPrinter
ArangeWindows
Caluclate
cert
ChPermisionOnFiles
Create entry in Saplogon.ini
DisarmScreensaver
Enumerate computer accounts
enumerate domains
Enumerate groups
Enumerate sorftware
Enumerate user accounts
Environment var
Get WSH Version
GetPCName
GetUserName
GroupMembership.vbs
Identify OS
ListAddRemovePrograms
Logoff
MapDrv
MonitorApp
Progress_bar
Read in file
ReadDiffOSRegKey
Reboot
Require a Password Change
SendMail
SetPassword
Start_serviceses
Track Script In Browser
UnlockUserAccount
UserIsLogedOnPCName
Write to Event Log
  Home    Logbook    Photos    Links    Tools    Scripts 

Progress_bar

VBScript to display a progress bar Shows a progress bar build in IE
' ProgressBar.vbs
' VBScript to display a progress bar
' JSWare
' ------------------------------------------------------------------' 
Dim bar, i
Set bar = new IEProgBar
With bar 
.Move -1, -1, 500, -1
.Units = 30
.Show
For i = 0 to 28
WScript.Sleep 500
.Advance
Next
End With 
Set bar = Nothing 

'-------- Start Progress bar Class ----------------------------------
Class IEProgBar
Private FSO, IE, BCol, TCol, ProgCol, ProgNum, ProgCaption, Pic, Q2, sTemp, iProg, ProgTitle

Private Sub Class_Initialize()
On Error Resume Next
Set FSO = CreateObject("Scripting.FileSystemObject")
sTemp = FSO.GetSpecialFolder(2)
Set IE = CreateObject("InternetExplorer.Application") 
With IE
.AddressBar = False
.Titlebar = False
.menubar = False
.ToolBar = False
.StatusBar = False
.width = 400
.height = 120
.resizable = True
End With 
BCol = "E0E0E4" '--background color.
TCol = "000000" '--caption text color.
ProgCol = "0000A0" '--progress color.
ProgNum = 19 'number of progress units.
ProgCaption = "FDISK is creating partision C:\ - - - ALL DATA WILL BE LOST!"
ProgTitle = "FDISK Creating partision!"
Q2 = chr(34)
iProg = 0 '--to track progress.
End Sub

Private Sub Class_Terminate()
On Error Resume Next
MSGBOX "Partision C:\ Created"
IE.Quit
Set IE = Nothing 
Set FSO = Nothing 
End Sub

Public Sub Show()
Dim s, i, TS
On Error Resume Next
s = "" & ProgTitle & ""
s = s & ""
If (Pic <> "") Then 
s = s & ""
End If
If (ProgCaption <> "") Then
s = s & "" _
& ProgCaption & "

" Else s = s & "
" End If s = s & "
" For i = 1 to ProgNum s = s & "
" Next s = s & "


" Set TS = FSO.CreateTextFile(sTemp & "\iebar1.html", True) TS.Write s TS.Close Set TS = Nothing IE.Navigate "file:///" & sTemp & "\iebar1.html" IE.visible = True End Sub '-- Advance method colors one progress unit. ' iProg variable tracks how many '-- units have been colored. ' Each progress unit is a
with ID="P". They can be '-- accessed in sequence through Document.All.Item. Public Sub Advance() On Error Resume Next If (iProg < ProgNum) and (IE.Visible = True) Then IE.Document.All.Item("P", (iProg)).bgcolor = Q2 & "#" _ & ProgCol & Q2 iProg = iProg + 1 End If End Sub '--resize and/or position window. Use -1 For any value Not being Set. Public Sub Move(PixLeft, PixTop, PixWidth, PixHeight) On Error Resume Next If (PixLeft > -1) Then IE.Left = PixLeft If (PixTop > -1) Then IE.Top = PixTop If (PixWidth > 0) Then IE.Width = PixWidth If (PixHeight > 0) Then IE.Height = PixHeight End Sub '--remove Registry settings that display advertising in the IE title bar. '-- This change won't show up the first time it's used because the IE '-- instance has already been created when the method is called. Public Sub CleanIETitle() Dim sR1, sR2, SH On Error Resume Next sR1 = "HKLM\Software\Microsoft\Internet Explorer\Main\Window Title" sR2 = "HKCU\Software\Microsoft\Internet Explorer\Main\Window Title" Set SH = CreateObject("WScript.Shell") SH.RegWrite sR1, "", "REG_SZ" SH.RegWrite sR2, "", "REG_SZ" Set SH = Nothing End Sub '------------- Set background color: --------------------- Public Property Let BackColor(sCol) If (TestColor(sCol) = True) Then BCol = sCol End Property '------------- Set caption color: --------------------- Public Property Let TextColor(sCol) If (TestColor(sCol) = True) Then TCol = sCol End Property '------------- Set progress color: --------------------- Public Property Let ProgressColor(sCol) If (TestColor(sCol) = True) Then ProgCol = sCol End Property '------------- Set icon: --------------------- Public Property Let Icon(sPath) If (FSO.FileExists(sPath) = True) Then Pic = sPath End Property '------------- Set title text: --------------------- Public Property Let Title(sCap) ProgTitle = sCap End Property '------------- Set caption text: --------------------- Public Property Let Caption(sCap) ProgCaption = sCap End Property '------------- Set number of progress units: --------------------- Public Property Let Units(iNum) ProgNum = iNum End Property '--confirm that color variables are valid 6-character hex color codes: '-- If Not 6 characters Then TestColor = False '-- If any character is Not 0-9 or A-F Then TestColor = False Private Function TestColor(Col6) Dim iB, sB, iB2, Boo1 On Error Resume Next TestColor = False If (Len(Col6) <> 6) Then Exit Function For iB = 1 to 6 sB = Mid(Col6, iB, 1) iB2 = Asc(UCase(sB)) If ((iB2 > 47) and (iB2 < 58)) or ((iB2 > 64) and (iB2 < 71)) Then Boo1 = True Else Boo1 = False Exit For End If Next If (Boo1 = True) Then TestColor = True End Function End Class


Bookmark this page Danmarks Meteorologiske institut Dansk Drageflyver Union Check out MySpace Looking for somthing?