Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to display a progress window

850 views
Skip to first unread message

Pascal Boivin

unread,
Jul 24, 2009, 12:01:50 PM7/24/09
to microsoft.public.scripting.vbscript
Hi

Is it possible to show a window from a VBScript? I would like to show
some status while the script is working. The script is run from WSH on
the command line.

Thanks

Sub BigProcess
Dim I
<Show a progess window> "Starting..."
For I = 1 To 100
Call DoSomething(I)
<Update the progress window> "Done: " & FormatNumber(I) & "%"
Next
<Close the progress window>
End Sub

MikeB

unread,
Jul 24, 2009, 12:32:49 PM7/24/09
to
Maybe this will get you started:

<html>
<HEAD>
<TITLE>This is the Application Caption</TITLE>
<HTA:APPLICATION ID="oApp"
APPLICATIONNAME="Splash Screen"
BORDER="thick"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
CAPTION="YES"
ICON="C:\Program Files\RBTI\RBG7\Samples\Icons\win1.ico"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="normal">
<SCRIPT>
var cntr = 0;
var ID = 0;
function UpdateTimer()
{
cntr = cntr - 5000;
}
function UpdateProg()
{
//debugger;
//var IDtx;
if (ID <= 9)
{
document.getElementById('C' + ID.toString()).bgColor="blue";
}
//IDtx.bgcolor=blue;
ID++;
cntr = cntr-5000;
}
function init()
{
cntr = 30000;
UpdateProg();
var UpdateTime = window.setInterval('UpdateProg()',1000);
return;
}
function Terminate()
{
window.clearTimeout();
// window.close();
}
</SCRIPT>
</HEAD>

<body onload="init(); return false;" onUnload="Terminate(); return false;">
<table width="100%" cellpadding="0" cellspacing="0" hspace="0" vspace="0"
height=20>
<tr>
<td width="10%" bgcolor=white id="C0"></td>
<td width="10%" bgcolor=white id="C1"></td>
<td width="10%" bgcolor=white id="C2"></td>
<td width="10%" bgcolor=white id="C3"></td>
<td width="10%" bgcolor=white id="C4"></td>
<td width="10%" bgcolor=white id="C5"></td>
<td width="10%" bgcolor=white id="C6"></td>
<td width="10%" bgcolor=white id="C7"></td>
<td width="10%" bgcolor=white id="C8"></td>
<td width="10%" bgcolor=white id="C9"></td>
</tr>
</table>
</body>
</html>

"Pascal Boivin" <pascal...@nbautomation.com> wrote in message
news:xn0gd1c1l88e6w000@xpd300...

Tom Lavedas

unread,
Jul 24, 2009, 1:53:13 PM7/24/09
to
On Jul 24, 12:01 pm, "Pascal Boivin" <pascal.boi...@nbautomation.com>
wrote:

Here's an example I had handy ...

Dim oIE, oPgCtl, i
Set oIE = CreateObject("InternetExplorer.Application")

oPgCtl = ProgressBar(oIE) ' Create control and return object array
' properties can be altered before revealing bar
' For example, ...
oPgCtl(0).max = 250

oIE.Visible = 1 ' Reveals the progress bar

' For example, write an initial message to Message Area
oPgCtl(1).innerHTML = "<font size=+1><b>Running ...</b></font>"

' Simulate a proccess delay & update progress bar
With oPgCtl(0) ' Progress bar
For i=.min to .max step 10 ' step changes progress bar increment
.value = CSng(i)
Wscript.sleep 100 ' process goes here
Next
End With

' For example, write closing message to Message Area
oPgCtl(1).innerHTML = "<font size=+1><b>Maximum reached: " _
& oPgCtl(0).value & "</b></font>"

wsh.sleep 2000 ' wait 2 seconds - just for demo
oIE.quit

' -------------------------------------------------------------------
' Requires "InternetExplorer.Application" object (oIE) input
' Returns two element array:
'
' element 0 is the Progress Bar control object - 5 properties
' .focus, .value, .min, .max, .appearance & .borderstyle
'
' element 1 is a message area to receive progress text (HTML)
'
Function ProgressBar(oIE)
Dim oPgCtl, h, w
With oIE
.RegisterAsDropTarget = False
.Resizable = 0 : addressbar = 0 : menubar = 0 : .toolbar = 0
.statusbar = 0
'.FullScreen = True ' removes "chrome", but don't use with IE7+
.Navigate "about:blank"
Do Until .ReadyState = 4 : WScript.Sleep 50 : Loop
.document.open
.document.write _
"<html><head><title>Progress</title></head>" _
& "<body bgcolor=silver scroll=no" _
& " style='border-Style:outset;border-Width:3px'><center>" _
& "<table bgcolor=lightskyblue width=100% height=100%>" _
& "<tr valign=middle><td align=center>Progress: &nbsp; <object "_
& "classid=""clsid:35053A22-8589-11D1-B16A-00C0F0283628"" " _
& "id=PrgBar height=20 width=500></object>" _
& "</td></tr><tr><td align=center id=amsg>&nbsp;" _
& "</td></tr></table></center></body></html>"
.document.close
.document.parentWindow.status = "Working"
Do Until .ReadyState = 4 : WScript.Sleep 50 : Loop
with .document.parentwindow.screen
h = .availheight
w = .availwidth
end with
.height = h\8 : .width = 3 * (w\4)
.top = h\10 : .left = w\10
Set oPgCtl = .document.applets("PrgBar")
End with
' Bring progress bar to the front
CreateObject("Wscript.Shell").Appactivate "Progress"
With oPgCtl ' defaults - can be changed
.focus
.min = 0
.max = 100
.appearance = 1 'OR 0
.borderstyle = 0 'OR 1
End With
' Return references to the Progress Bar Control and the Message Area
Progressbar = Array(oPgCtl, oIE.document.all.amsg)
End Function
' -------------------------------------------------------------------

Reventlov

unread,
Jul 24, 2009, 4:24:48 PM7/24/09
to
Il giorno Fri, 24 Jul 2009 12:01:50 -0400, "Pascal Boivin"
<pascal...@nbautomation.com> ha scritto:

>Is it possible to show a window from a VBScript? I would like to show
>some status while the script is working. The script is run from WSH on
>the command line.

In the command line you could put a colon every n files/data/arrays processed. Just to
show that something is happening.

My favourite method is as follows, but so far nobody in the newsgroup seemed to appreciate
it. Notice that your processing will start a lot before Merlin starts to prepare the magic
potion.

'************************************************
' File: Processing.vbs 22.1.2009
' Autore: Giovanni Cenati
'reventlov at katamail com
'************************************************

Dim Agent, Merlin,n,animation
Set Agent = CreateObject("Agent.Control.2")
Agent.Connected = true
Agent.Characters.Load "merlin", _
"c:\windows\msagent\chars\merlin.acs"
Set Merlin = Agent.Characters("merlin")
Merlin.Left = 0
Merlin.Top = 0
Merlin.Show
Merlin.MoveTo 220,240

merlin.play "domagic1"
merlin.play "domagic2"
merlin.play "confused"
merlin.play "announce" ' these conclude automatically
merlin.play "processing" 'this must be concluded with the stop method
msgbox "The actions are queued and the script arrives here before they are concluded.
Click OK to stop processing."
merlin.stop
merlin.play "read"
merlin.play "write"
merlin.play "search"

Merlin.Speak "Hello"
merlin.play "congratulate"
merlin.think "I think it works...."
merlin.listen true
merlin.play "wave"
Merlin.Hide

'This waits until all the actions are concluded (waits the Hide method)
'If you remove the sleep loop, the script does not wait for all
'the actions to be completed.
Do While Merlin.Visible: WScript.Sleep 10 : Loop
Agent.connected = false
Set Merlin = Nothing
Set Agent = Nothing
--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--

Reventlov

unread,
Jul 24, 2009, 4:24:49 PM7/24/09
to
Il giorno Fri, 24 Jul 2009 12:01:50 -0400, "Pascal Boivin"
<pascal...@nbautomation.com> ha scritto:

>Is it possible to show a window from a VBScript? I would like to show


>some status while the script is working. The script is run from WSH on
>the command line.

Another method uses an IE window.
I'm very happy tonight because Mayayana solved my problem with vbs drag and drop registry
entries.


'*** Crea una finestra che funge da output ***
Dim myIE, IEWindow
Set myIE = CreateObject("InternetExplorer.Application")
myIE.Navigate "about:blank"
myIE.ToolBar = False:myIE.StatusBar = False:myIE.Resizable = False
Do
Loop While myIE.Busy
myIE.Width = 500:myIE.Height=500
myIE.Left = 50:myIE.Top = 50
myIE.Visible = True
myIE.document.writeln("<html><title>" & Title & "</title>"&_
"<body><div id='cont'></div></body></html>")
'myIE.Document.title= Title
Set IEWindow = myIE.Document.All("cont")
IEWindow.INNERHTML = "<h1>This is only the beginning"
wscript.sleep 3000 'processing here
IEWindow.INNERHTML = "<h1>Somethin happened"

Tom Lavedas

unread,
Jul 25, 2009, 11:08:25 AM7/25/09
to
On Jul 24, 4:24 pm, no...@no.void (Reventlov) wrote:
> Il giorno Fri, 24 Jul 2009 12:01:50 -0400, "Pascal Boivin"
> <pascal.boi...@nbautomation.com> ha scritto:
> Write to "Reventlov" at katamail comhttp://digilander.libero.it/Cenati(Esempi e programmi in VbScript)
> --

I love it. I've looked at MSAgents in the bast, but never could get
into them. For one thing, I feel their canned actions take too long,
so they can easily slow thing down - as your script illustrates -
though yours lays it on pretty thick ;-)

One small quibble I have is that I found the hard coding of the
SystemRoot to be problematic. The machine I am on was upgraded from
Win2K to XP so that its SystemRoot folder is not named Windows, but
rather the older WINNT. So, in cases like this, it's best to do
something like this instead ...

'...
sSystemRoot = CreateObject("Wscript.shell")_
.Environment("PROCESS")("SYSTEMROOT")
Agent.Characters.Load "merlin", _
sSystemRoot & "\msagent\chars\merlin.acs"
'...

You also failed to mention the other 'official' MSAgent charaters
available for free download here: www.microsoft.com/products/msagent/main.aspx.
A google search will turn up a number of other places to get
characters.

Thanks for the chuckle,

Tom Lavedas
***********

Pascal Boivin

unread,
Jul 27, 2009, 8:47:08 AM7/27/09
to microsoft.public.scripting.vbscript
That's what I was looking for. Thanks!

mayayana

unread,
Jul 27, 2009, 9:36:02 AM7/27/09
to

> That's what I was looking for. Thanks!

Be sure you test that on any system where
you might be using it. The OBJECT tag references
a progress bar control from mscomctl.ocx. That
file comes with VB6. (It may also come with some
or all versions of MS Office. I don't know.) The
file requires a license. In other words, Tom Lavedas
has installed something that gives him a license to
use the Microsoft "common controls", so the progress
bar control works for him. But on PCs where that is not
the case the bar won't work. The file mscomctl.ocx
itself may not even be present.

With any commercial ActiveX controls -- including
those from Microsoft -- using them
will give you extra options but at the same time
limited support. If you want to use the "fancy" version
you might want to also have an IE-only version around
for scripts that need to run elsewhere than on your
own PC or controlled local network. On the other hand,
if you want a fancy version and don't mind needing to
install a control, there are also other options for various
types of progress bars.


Tom Lavedas

unread,
Jul 27, 2009, 9:45:28 AM7/27/09
to

Yes, you are exactly right, as I found out this weekend on a home
machine that does NOT have the necessary license rights. I had failed
to realize that fact when I found that sample in my archive of bits
and pieces (it's not something I actually use). I had thought it was
just a standard (but little used) IE control. As I recall, I adapted
it from a posting I saw in a news group, somewhere. I guess I need to
document that stuff better.

Tom Lavedas
***********

mayayana

unread,
Jul 27, 2009, 10:08:52 AM7/27/09
to
>
Yes, you are exactly right, as I found out this weekend on a home
machine that does NOT have the necessary license rights. I had failed
to realize that fact when I found that sample in my archive of bits
and pieces (it's not something I actually use). I had thought it was
just a standard (but little used) IE control. As I recall, I adapted
it from a posting I saw in a news group, somewhere. I guess I need to
document that stuff better.
>

That stuff is like a child seeing a Christmas tree
with gifts, but through a window. :) There are so many
controls on the typical system but very few that
don't need a license. The only ones I can think of
offhand, other than 3rd-party controls that have to
be installed, are the basic IE controls and maybe a
couple of Active Desktop odds and ends like webvw.dll.

The IE controls were discontinued after Win98 1st,
I think: iemenu.ocx, ielabel.ocx, ietimer.ocx
They weren't all that great, anyway, but it's a shame
that they were removed. iemenu.ocx could show a
system menu.

Webvw.dll can be used to render thumbnails, but IE
with width and height spec-ed in an IMG tag does
just as well.


mr_unreliable

unread,
Jul 27, 2009, 1:32:04 PM7/27/09
to
Yes, microsoft common controls ocx is a licensed control,
but also, anything based on IE is not exactly hassle-free
either. I do keep seeing stuff that worked in IEX, but
somehow doesn't work in IEX+1. Either ms doesn't particularly
care about vbs script compatibility when developing a new IE,
or else they take a hellish delight in torpedoing old scripts.

I have another suggestion. Take a look at the "Common Controls
Replacement Project" (CCRP) website. The CCRP gang of programmers
are so arrogant that they claimed that they could develop a set
of common controls that are SUPERIOR to the ms (ocx) controls.
imho, they succeeded.

More to the point, take a look at their progress bar control:

http://ccrp.mvps.org/index.html?controls/ccrpprogbar6.htm

It is free. It is an actX control which will work with vb,
and with IE (and any other language with a com interface).
And yes, it will do everything that the ms common controls
ocx version will do, and more...

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)

p.s. for an even more dazzling progress bar control, that a
look at Steve McMahon's (vbAccelerator) control:

http://www.vbaccelerator.com/home/vb/code/Controls/Progress_Bar/Progress_Bar_Control/article.asp

Also free actx control.

Tom Lavedas

unread,
Jul 27, 2009, 5:41:10 PM7/27/09
to

There is also the 'roll-your-own' approach. Hopefully the SPAN will
never become obsolete ...

' Just an example of how to use the function
'
Dim g_aControl ' global variable to store control array
Dim i, i0

g_aControl = ProgressBar("Progress: ", "Process started ...")
'wsh.echo "Width:",aControl(0).style.width
' Show the control
g_aControl(2).visible = true
' Default start value
i0 = Replace(g_aControl(0).style.width, "%", "")

for i =i0 to 101 step 2
g_aControl(0).style.width = i & "%"
wsh.sleep 100 ' simulate the 'process' delay
next
' For example
g_aControl(1).innerText = "Process complete"
wsh.sleep 1000 ' to let user see closing message
g_aControl(2).quit

sub IE_OnQuit ' to handle user closing control
with g_aControl(2) ' uses the browser part of control
.stop
.visible = false
.quit
end with
wsh.echo "Terminated by User"
wsh.quit
end sub

'
' Tom Lavedas <tlav...@hotmail.com>
'
'
Function ProgressBar(sPrompt, sMsg)
set oIE = WScript.createObject("InternetExplorer.Application",
"IE_")
With oIE
' Configure the IE window
.RegisterAsDropTarget = False
.addressbar = false : .statusbar = false
.toolbar = false : .menubar = false
.Resizable = False
' .FullScreen = True ' removes "chrome" - do not use for IE7+
.width = 600 : .height = 100


.Navigate "about:blank"
Do Until .ReadyState = 4 : WScript.Sleep 50 : Loop

With .document
oIE.left = .parentWindow.screen.width \ 2 - 300
oIE.top = .parentWindow.screen.height\ 2 - 50
.open
.write "<html><head>" _
& "<title>Progress _</title></head><body scroll=no" _
& " bgcolor=silver>" & sPrompt _
& "<span style='height:25;width:80%;border:""medium
inset"";" _
& "background:white'>" _
& "<span id=Bar style='height:20px;width:
2%;background:blue'>"_
& "</span></span>" _
& "<p><b><em><span id=amsg>" & sMsg & "</span>" _
& "</em></b></body></html>"
.close
Do Until .ReadyState = "complete" : WScript.Sleep 100 : Loop
' Try to bring the display to the front ...
CreateObject("Wscript.Shell").Appactivate "Progress:"
' Return three objects: Control, Message space, and Browser
ProgressBar = Array(.all.bar, .all.amsg, oIE)
End With ' document
End With ' IE
End Function

It's badly documented, but it should work on all versions of IE that
support the SPAN tag ;-).

Tom Lavedas
***********

p byers

unread,
Jul 28, 2009, 3:09:25 AM7/28/09
to

Tom Lavedas wrote:

Hi
I find the subject interesting and like Toms "roll-your-own"

However, it seems to me that the solutions offered assume a fixed time for
the Event being Progressed.

Take for example a Download, where the time varies dependant on the line
speed and quality.

Another example, processing a large array, the time would depend on the
number of entries in the array.

It seems to me that it should be possible to present and use two numeric
parameters

1. The "Full Number" - the number being aimed for and

2. The "Number Processed" - the number processed to date

When I get some time, I will enjoy trying to adapt Toms script to show
"Actual Progress" - if I succeed, I will post the result in here - if anyone
is interested !!


Pete (Northolt UK)

mayayana

unread,
Jul 28, 2009, 8:14:09 AM7/28/09
to
> It seems to me that it should be possible to present and use two numeric
> parameters
>
> 1. The "Full Number" - the number being aimed for and
>
> 2. The "Number Processed" - the number processed to date
>
> When I get some time, I will enjoy trying to adapt Toms script to show
> "Actual Progress" - if I succeed, I will post the result in here - if
anyone
> is interested !!
>

Tom was just demonstrating the basic
functionality. In actual usage you'd really
need to have some kind of "full number"
to work off of. (Something like 100 files to
copy, divided by 30 increments = 3 files per
increment.)

I think that your examples, though, show
how tricky it is to have a really useful progress
bar: A very large array is rarely large enough to
need a progress bar. And if you want to use a bar
for a download then you have to be in a position
to know the size of the download while also
managing the actual data reception at the level
of bytes.

That makes me think of the Windows Explorer
file moving progress bar. For some reason MS
decided to get fancy and predict the *time left*
rather than reporting the percentage of data
moved. So it hits a big file and reports 74 minutes
left... then it hits a bunch of little GIFs and reports
8 minutes left....then it's back up to 93 minutes
left. :)

Reventlov

unread,
Jul 29, 2009, 5:00:29 PM7/29/09
to
Il giorno Sat, 25 Jul 2009 08:08:25 -0700 (PDT), Tom Lavedas <tglb...@cox.net> ha
scritto:

>One small quibble I have is that I found the hard coding of the
>SystemRoot to be problematic. The machine I am on was upgraded from
>Win2K to XP so that its SystemRoot folder is not named Windows, but
>rather the older WINNT. So, in cases like this, it's best to do
>something like this instead ...
>'...
>sSystemRoot =3D CreateObject("Wscript.shell")_

> .Environment("PROCESS")("SYSTEMROOT")
>Agent.Characters.Load "merlin", _
> sSystemRoot & "\msagent\chars\merlin.acs"
>'...
Thank you, Tom.
I'm going to fix it for later use. In my company all installations are similar and
unfortunately Merlin is the only .acs available. But he is in the same path in all the
pc's.

Merlin answers the question "did the script really start?" as it shows something to the
user. When searching for data through the directories, Merlin looks like it takes less
time. In one of my scripts, I have to search in a directory for a specific document.
By the time he appears in a corner and moves to the center of the screen, the script reads
a hundred files. If you make him say something, the job is done and the user is not aware
of the time spent.

Anyway, sometimes the search ends before the queued animations are finished. If you cut
the final loop, you will never see some actions but the search (the script) takes less
time.

Disclaimer: your boss could non like it.


>
>You also failed to mention the other 'official' MSAgent charaters

>available for free download here: www.microsoft.com/products/msagent/main.a=


>spx.
>A google search will turn up a number of other places to get
>characters.

True. And official characters (at least) really speak if you download the speech api.
Which I believe are already shipped with MS Vista.

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com

http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--

Reventlov

unread,
Jul 29, 2009, 5:53:02 PM7/29/09
to
Il giorno Mon, 27 Jul 2009 14:41:10 -0700 (PDT), Tom Lavedas <tglb...@cox.net> ha
scritto:

>There is also the 'roll-your-own' approach. Hopefully the SPAN will
>never become obsolete ...

This is a progress bar Class I found somewhere. It uses an html table.

Dim bar, i
Set bar = new IEProgBar
With bar
.BackColor = "FFFFDD"
.TextColor = "FF0000"
.ProgressColor = "0000FF"
.Caption = "Trying some new colors."
.Title = "Another progress bar"
.Move 10, 10, 0, 0
.Show
For i = 0 to 19
WScript.Sleep 500
.Advance
Next
End With
Set bar = Nothing

'-----
//////////////////////////////////////////////////////////////////////////////////////////////

' -- Progress Bar Class that can be pasted into scripts.
'-- To create Progress Bar: Dim ob
' Set ob = New IEProgBar

'-- This progress bar is created with an HTML file, which is written to the Temp folder
'-- and opened from there.

'-- Methods and Properties:

' Methods -

' Show - displays progress bar by writing file, causing IE to open it and
setting IE visible.
' Advance - advances progress by 1 unit.
' Move(Left, Top, Width, Height) - moves and/or resizes window. All parameters
must be used.
' use -1 For any dimension Not
being changed: ob.Move 10, 10, -1, -1
' default size is 400 W x 120 H.
default position is Windows default.

' CleanIETitle - removes Registry settings that append advertising to the page
' title in the IE title bar so that only the specified Title
Property
' will be displayed. (This is a general change to IE and is
Not reversible
' with this script as written.)

' Properties -

' BackColor - 6-character hex code to specify background color. default is
"E0E0E4".
' TextColor - 6-character hex code to specify caption text color. default is
"000000".
' ProgressColor - 6-character hex code to specify progress color. default is
"0000A0".
' Title - window title text. default is "Progress"
' Caption - text caption in window. default is "Progress. . ."
' Units - number of progress units to use. default is 20.
' Icon - path of any image file that can be used as an icon. (JPG, GIF, BMP or
ICO)
' default is no icon. If an icon is specifed it appears to left of
caption.


'---
////////////////////////////////////////////////////////////////////////////////////////


'-------- 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
.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 = 20 'number of progress units.
ProgCaption = "Progress. . ."
ProgTitle = "Progress"
Q2 = chr(34)
iProg = 0 '--to track progress.
End Sub

Private Sub Class_Terminate()
On Error Resume Next
IE.Quit
Set IE = Nothing
Set FSO = Nothing
End Sub

Public Sub Show()
Dim s, i, TS
s = "<HTML><HEAD><TITLE>" & ProgTitle & "</TITLE></HEAD>"
s = s & "<BODY SCROLL=" & Q2 & "NO" & Q2 & " BGCOLOR=" & Q2 & "#" & BCol & Q2 & "
TEXT=" & Q2 & "#" & TCol & Q2 & ">"
If (Pic <> "") Then
s = s & "<IMG SRC=" & Q2 & Pic & Q2 & " ALIGN=" & Q2 & "Left" & Q2 & ">"
End If
If ProgCaption <> "" Then
s = s & "<FONT FACE=" & Q2 & "arial" & Q2 & " SIZE=2>" & ProgCaption &
"</FONT><BR><BR>"
Else
s = s & "<BR>"
End If
s = s & "<TABLE BORDER=1><TR><TD><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR>"
For i = 1 to ProgNum
s = s & "<TD WIDTH=16 HEIGHT=16 ID=" & Q2 & "P" & Q2 & ">"
Next
s = s & "</TR></TABLE></TD></TR></TABLE><BR><BR></BODY></HTML>"
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 <TD> 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

mayayana

unread,
Jul 29, 2009, 7:35:53 PM7/29/09
to

>
> This is a progress bar Class I found somewhere. It uses an html table.
>

That one's mine. According to my files here
I updated it some time back and included the
new version in the download. I haven't actually
looked at it for a long time, though, and I never
tested it with the limitations of Vista/7.

www.jsware.net/jsware/scripts.php5#clsbar


Reventlov

unread,
Aug 3, 2009, 5:06:02 PM8/3/09
to
Il giorno Wed, 29 Jul 2009 19:35:53 -0400, "mayayana" <mayaX...@rcXXn.com> ha scritto:

>> This is a progress bar Class I found somewhere. It uses an html table.
>>
> That one's mine. According to my files here
>I updated it some time back and included the
>new version in the download. I haven't actually
>looked at it for a long time, though, and I never
>tested it with the limitations of Vista/7.

You should put your name and a reference to your web page.
For a millisecond I thought about claiming that code to be mine.

Giovanni.

mayayana

unread,
Aug 3, 2009, 7:46:39 PM8/3/09
to
> You should put your name and a reference to your web page.
> For a millisecond I thought about claiming that code to be mine.
>
I guess we just averted a long, drawn-out
court battle. :)


0 new messages