<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>North Atlanta Web Design &#187; VBScript</title>
	<atom:link href="http://www.northatlantawebdesign.com/index.php/tag/vbscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.northatlantawebdesign.com</link>
	<description>Programming Examples, Samples, and Tutorials</description>
	<lastBuildDate>Fri, 09 Jul 2010 13:08:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>VBScript String Methods in a Simple PHP Class</title>
		<link>http://www.northatlantawebdesign.com/index.php/2009/08/24/vbscript-string-methods-in-a-simple-php-class/</link>
		<comments>http://www.northatlantawebdesign.com/index.php/2009/08/24/vbscript-string-methods-in-a-simple-php-class/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 20:42:52 +0000</pubDate>
		<dc:creator>Jeff Gibeau</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Strings]]></category>
		<category><![CDATA[Wrapper]]></category>

		<guid isPermaLink="false">http://www.northatlantawebdesign.com/?p=172</guid>
		<description><![CDATA[When some people start out in a new language, they are in it for the long haul.  Other people sometimes just need to touch on it without getting into the details.  PHP is one of those languages where you can do things in a quick and dirty way without getting into the details.  I have [...]]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><p>When some people start out in a new language, they are in it for the long haul.  Other people sometimes just need to touch on it without getting into the details.  <a type="amzn">PHP</a> is one of those languages where you can do things in a quick and dirty way without getting into the details.  I have written a simple class for the kind of person that just wants to get a few things done quickly that is familiar with VBScripting.  The class is mainly a wrapper class that allows you to perform <a type="amzn">VBScript</a> style methods on strings in PHP.  For instance, you can use VBScript::Left($string, $length) instead of using PHP&#8217;s substr($string, 0, $length).  Enjoy!<br />
<span id="more-172"></span></p>
<pre class="brush: php;">
&lt;?php
/*****************************************************************************\
Author: Jeff Gibeau
WebSite: http://www.NorthAtlantaWebDesign.com
Purpose:
A string operation wrapper class that allows you to use VBScript style methods
in place of PHP style methods.  Recreates all methods from:

http://www.w3schools.com/VBscript/vbscript_ref_functions.asp#string

\*****************************************************************************/
class VBString
{
	//Returns the position of the first occurrence of one string within another.
	//The search begins at the first character of the string.
	function InStr($haystack, $needle, $startPosition = 0)
	{
		return strpos($haystack, $needle, $startPosition);
	}

	//Returns the position of the first occurrence of one string within another.
	//The search begins at the last character of the string.
	function InStrRev($haystack, $needle, $startPosition = 0)
	{
		if(floatval(phpversion()) &gt;= 5)
			return strrpos($haystack, $needle, $startPosition);
		else
			return strrpos($haystack, $needle);
	}

	//Converts a specified string to lowercase.
	function LCase($string)
	{
		return strtolower($string);
	}

	//Returns a specified number of characters from the left side of a string.
	function Left($string, $length)
	{
		return substr($string, 0, $length);
	}

	//Returns the number of characters in a string.
	function Len($string)
	{
		return strlen($string);
	}

	//Removes spaces on the left side of a string.
	function LTrim($string)
	{
		return ltrim($string);
	}

	//Removes spaces on the right side of a string.
	function RTrim($string)
	{
		return rtrim($string);
	}

	//Removes spaces on both the left and the right side of a string.
	function Trim($string)
	{
		return trim($string);
	}

	//Returns a specified number of characters from a string.
	function Mid($string, $start, $length = &quot;&quot;)
	{
		if(!empty($length))
			return substr($string, $start, $length);
		else
			return substr($string, $start);
	}

	//Replaces a specified part of a string with another string a specified
	//number of times.
	function Replace($haystack, $needle, $replaceWith, $start = -1, $count = -1)
	{
		$returnVal = $haystack;
		if($start != -1)
		{
			if($count != -1 &amp;&amp; floatval(phpversion()) &gt;= 5)
			{
				$returnVal = substr($haystack, 0, $start) . str_replace($needle, $replaceWith, substr($haystack, $start), $count);
			}
			else
			{
				$returnVal = substr($haystack, 0, $start) . str_replace($needle, $replaceWith, substr($haystack, $start));
			}
		}
		else
		{
			if($count != -1 &amp;&amp; floatval(phpversion()) &gt;= 5)
			{
				$returnVal = str_replace($needle, $replaceWith, $haystack, $count);
			}
			else
			{
				$returnVal = str_replace($needle, $replaceWith, $haystack);
			}
		}
		return $returnVal;
	}

	//Returns a specified number of characters from the right side of a string.
	function Right($string, $count)
	{
		return substr($string, ($count * -1));
	}

	//Returns a string that consists of a specified number of spaces.
	function Space($numSpaces)
	{
		$returnVal = '';
		for($i = 0; $i &lt; $numSpaces; $i++)
			$returnVal .= ' ';
		return $returnVal;
	}

	//Compares two strings and returns a value that represents the result of
	//the comparison.
	function StrComp($string1, $string2)
	{
		return strcmp($string1, $string2);
	}

	//Returns a string that contains a repeating character of a specified length.
	function String($length, $character)
	{
		$returnVal = '';
		while(strlen($returnVal) &lt; $length)
			$returnVal .= $character;
		return substr($returnVal, 0, $length);
	}

	//Reverses a string.
	function StrReverse($string)
	{
		return strrev($string);
	}

	//Converts a specified string to uppercase.
	function UCase($string)
	{
		return strtoupper($string);
	}
}
?&gt;
</pre>
<p>Using this class</p>
<pre class="brush: php;">
&lt;?php
require_once 'vbstring_class.php';
$string1 = '  The quick brown fox jumped over the lazy dog.  ';
$string2 = 'he';
$string3 = 'hat';
$nl = &quot;\n&quot;;
echo '
&lt;style&gt;
* { font-family:courier; }
span.answer { color:red; background:#eeeeee;border:1px solid #ccc; }
&lt;/style&gt;
&lt;pre&gt;
';
//VBString::InStr
echo 'VBString::InStr(&quot;'.$string1.'&quot;, &quot;'.$string2.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;'. VBString::InStr($string1, $string2).'&lt;/span&gt;'.$nl;

//VBString::InStrRev
echo 'VBString::InStrRev(&quot;'.$string1.'&quot;, &quot;'.$string2.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;'. VBString::InStrRev($string1, $string2).'&lt;/span&gt;'.$nl;

//VBString::LCase
echo 'VBString::LCase(&quot;'.$string1.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'. VBString::LCase($string1).'&quot;&lt;/span&gt;'.$nl;

//VBString::Left
echo 'VBString::Left(&quot;'.$string1.'&quot;, 5) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::Left($string1, 5).'&quot;&lt;/span&gt;'.$nl;

//VBString::Len
echo 'VBString::Len(&quot;'.$string1.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;'.VBString::Len($string1).'&lt;/span&gt;'.$nl;

//VBString::LTrim
echo 'VBString::LTrim(&quot;'.$string1.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::LTrim($string1).'&quot;&lt;/span&gt;'.$nl;

//VBString::RTrim
echo 'VBString::RTrim(&quot;'.$string1.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::RTrim($string1).'&quot;&lt;/span&gt;'.$nl;

//VBString::Trim
echo 'VBString::Trim(&quot;'.$string1.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::Trim($string1).'&quot;&lt;/span&gt;'.$nl;

//VBString::Mid
echo 'VBString::Mid(&quot;'.$string1.'&quot;, 5, 5) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::Mid($string1, 5, 5).'&quot;&lt;/span&gt;'.$nl;

//VBString::Replace
echo 'VBString::Replace(&quot;'.$string1.'&quot;, &quot;'.$string2.'&quot;, &quot;'.$string3.'&quot;, 5) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::Replace($string1, $string2, $string3, 5).'&quot;&lt;/span&gt;'.$nl;

//VBString::Right
echo 'VBString::Right(&quot;'.$string1.'&quot;, 5) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::Right($string1, 5).'&quot;&lt;/span&gt;'.$nl;

//VBString::Space
echo 'VBString::Space(10) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::Space(10).'&quot;&lt;/span&gt;'.$nl;

//VBString::StrComp
echo 'VBString::StrComp(&quot;'.$string1.'&quot;, &quot;'.$string1.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::StrComp($string1, $string1).'&quot;&lt;/span&gt;'.$nl;

//VBString::String
echo 'VBString::String(10, &quot;*&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::String(10, &quot;*&quot;).'&quot;&lt;/span&gt;'.$nl;

//VBString::StrReverse
echo 'VBString::StrReverse(&quot;'.$string1.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'.VBString::StrReverse($string1).'&quot;&lt;/span&gt;'.$nl;

//VBString::UCase
echo 'VBString::UCase(&quot;'.$string1.'&quot;) -&gt; &lt;span class=&quot;answer&quot;&gt;&quot;'. VBString::UCase($string1).'&quot;&lt;/span&gt;'.$nl;

echo '&lt;/pre&gt;';
?&gt;
</pre>
<p>Useful Links:</p>
<ul>
<li><a href="http://www.w3schools.com/VBscript/vbscript_ref_functions.asp#string">W3Schools VBScript String Methods</a></li>
<li><a href="http://us2.php.net/manual/en/book.strings.php">PHP Strings Manual</a></li>
</ul>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.northatlantawebdesign.com/index.php/2009/08/24/vbscript-string-methods-in-a-simple-php-class/')" href="http://www.sphere.com/search?q=sphereit:http://www.northatlantawebdesign.com/index.php/2009/08/24/vbscript-string-methods-in-a-simple-php-class/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.northatlantawebdesign.com/index.php/2009/08/24/vbscript-string-methods-in-a-simple-php-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTA Progress Bar using VBScript and JavaScript</title>
		<link>http://www.northatlantawebdesign.com/index.php/2009/07/17/hta-progress-bar-using-vbscript-and-javascript/</link>
		<comments>http://www.northatlantawebdesign.com/index.php/2009/07/17/hta-progress-bar-using-vbscript-and-javascript/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 17:53:30 +0000</pubDate>
		<dc:creator>Jeff Gibeau</dc:creator>
				<category><![CDATA[HTML Applications]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[HTA]]></category>
		<category><![CDATA[Progress Bar]]></category>
		<category><![CDATA[Progressbar]]></category>
		<category><![CDATA[VBScript Front End]]></category>
		<category><![CDATA[VBScript GUI]]></category>

		<guid isPermaLink="false">http://www.northatlantawebdesign.com/?p=88</guid>
		<description><![CDATA[I was informed after my last post that using HTA (HTML Applications) to display a progress bar in VBScript is much more efficient than using InternetExplorer.Application within a VBScript. Having never used HTA before, I immediately set out to learn a bit and see what I could come up with. My initial thoughts are mixed, [...]]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><p>I was informed after my <a href="http://www.northatlantawebdesign.com/index.php/2009/07/16/simple-vbscript-progress-bar/">last post</a> that using <a type="amzn">HTA</a> (HTML Applications) to display a progress bar in <a type="amzn">VBScript</a> is much more efficient than using InternetExplorer.Application within a VBScript.  Having never used HTA before, I immediately set out to learn a bit and see what I could come up with.</p>
<p>My initial thoughts are mixed, as <strong>you can not run and interact with an HTA from a VBScript file</strong>.  This requires you to wrap your VBScript code in whatever HTML Application you are writing.  This greatly limits re-usability, enough so that the increase in performance may not warrant using an HTA for a progress bar in most cases.<br />
<span id="more-88"></span><br />
I would like to note that this is a first draft of this script, and I may update it in the future, if I deem HTML Applications the way to go.  As for now, I am not convinced.</p>
<pre class="brush: vb;">
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;HTA Progress Bar&lt;/title&gt;
&lt;script language=&quot;vbscript&quot;&gt;
'This script resizes and moves the window to the center of the screen.
'The placement of this code above the HTA definition, moves the window
'before the script is visible.
height = screen.height
width = screen.width
moveto width/2 - 335/2,height/2 - 200/2
resizeto 335,200
&lt;/script&gt;
	&lt;HTA:APPLICATION ID=&quot;oMyApp&quot;
		APPLICATIONNAME=&quot;monster&quot;
		SINGLEINSTANCE=&quot;yes&quot;
		BORDER=&quot;thin&quot;
		MAXIMIZEBUTTON=&quot;no&quot;
&gt;

&lt;script language=&quot;VBScript&quot; type=&quot;text/vbscript&quot;&gt;
'This is where your VBScript logic should go.
' Call OpenProgressBar to open the progressbar
' Call UpdateLog to update the logging window
' Call UpdateProgressBar to move the bar
' Call CloseProgressBar to return to your main UI window
Sub BeginImportingFiles()
	Dim i
	OpenProgressBar()
	UpdateLog &quot;Step 1 of 2&quot;, &quot;&quot;
	For i = 1 to 10
		Sleep 100
		UpdateLog &quot;Next Step&quot;, &quot;&quot; &amp; Time()
		UpdateProgressBar i*10, &quot;Step 1 of 2&quot;
	Next
	UpdateLog &quot;Step 1 of 2&quot;, &quot;Complete&quot;
	Sleep 2000
	CloseProgressBar()
End Sub

Sub Sleep(MSecs)
	Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	If Fso.FileExists(&quot;sleeper.vbs&quot;)=False Then
	Set objOutputFile = fso.CreateTextFile(&quot;sleeper.vbs&quot;, True)
	objOutputFile.Write &quot;wscript.sleep WScript.Arguments(0)&quot;
	objOutputFile.Close
	End If
	CreateObject(&quot;WScript.Shell&quot;).Run &quot;sleeper.vbs &quot; &amp; MSecs,1 , True
End Sub

&lt;/script&gt;
&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
function OpenProgressBar()
{
	document.getElementById(&quot;gui&quot;).style.display=&quot;none&quot;;
	document.getElementById(&quot;progressbargui&quot;).style.display=&quot;block&quot;;
}

function UpdateLog(text, status)
{
	var log = document.getElementById(&quot;log&quot;);
	if(status &amp;&amp; status != &quot;&quot;)
	{
		var maxLength = 33;
		var dotlength = maxLength - (text.length + status.length);
		var dots = &quot;&quot;;
		for(i = 0;i&lt;dotlength;i++)
			dots += &quot;.&quot;;
		log.value += text + dots + &quot;[&quot; + status + &quot;]\n&quot;;
	}
	else
		log.value += &quot;[&quot; + text + &quot;]&quot; + &quot;\n&quot;;
	log.scrollTop = log.scrollHeight;
}

function UpdateProgressBar(percentComplete, title, status)
{
	for(i = 1; i &lt;= 100; i++)
	{
		if((percentComplete) &gt;= i)
			document.getElementById(&quot;pbar&quot;+i).className = &quot;pbarcomplete&quot;;
		else
			document.getElementById(&quot;pbar&quot;+i).className = &quot;pbar&quot;;
		document.title = title &amp;&amp; title != &quot;&quot; ? title : percentComplete + &quot;% Complete&quot;;
		document.getElementById(&quot;progresstitle&quot;).innerText = status &amp;&amp; status != &quot;&quot; ? status : percentComplete + &quot;% Complete&quot;;
	}
}

function CloseProgressBar()
{
	document.getElementById(&quot;gui&quot;).style.display=&quot;block&quot;;
	document.getElementById(&quot;progressbargui&quot;).style.display=&quot;none&quot;;
	UpdateProgressBar(0,&quot;&quot;,&quot;&quot;);
	document.getElementById(&quot;log&quot;).value = &quot;&quot;;
}
&lt;/script&gt;
&lt;script language=&quot;VBScript&quot; type=&quot;text/vbscript&quot;&gt;
'Progress Bar Logic
&lt;/script&gt;
&lt;style type=&quot;text/css&quot;&gt;
body,html {
	margin:auto;
}
div#progressbar{
border:1px solid #ccc;
margin:0px;padding:0px;
}
span.pbar{
	width:3px;
	margin:0px;
	padding:0px;
	border-left:1px solid #fff;
	background:#fff;
	line-height:5px;
	height:16px;
	font-size:2px;
}
span.pbarcomplete{
	width:3px;
	margin:0px;
	padding:0px;
	border-right:1px solid #ccc;
	background:green;
	line-height:5px;
	height:16px;
	font-size:2px;

}
table {
	width:100%;
	height:100%;
}
table td {
	text-align:center;
	vertical-align:center;
}
table td.progressbargui {
	display:none;
	vertical-align:top;
}
textarea#log{
	width:100%;
	height:100px;
	border:1px solid #aaa;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
&lt;tr&gt;
	&lt;td id=&quot;gui&quot;&gt;&lt;input type=&quot;button&quot; onclick=&quot;BeginImportingFiles()&quot; value=&quot;Begin File Import&quot;/&gt;&lt;/td&gt;
	&lt;td id=&quot;progressbargui&quot; class=&quot;progressbargui&quot;&gt;
		&lt;div id=&quot;progresstitle&quot;&gt;&amp;nbsp;&lt;/div&gt;
		&lt;div id=&quot;progressbar&quot;&gt;
		&lt;script type=&quot;text/javascript&quot;&gt;
		for(i = 1; i &lt;= 100; i++)
			document.write(&quot;&lt;span id=\&quot;pbar&quot; + i + &quot;\&quot; class=\&quot;pbar\&quot;&gt;&lt;/span&gt;&quot;);
		&lt;/script&gt;
		&lt;/div&gt;
		&lt;textarea id=&quot;log&quot;&gt;&lt;/textarea&gt;
	&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Some potentially useful links dealing with HTA:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ms536496%28VS.85%29.aspx" target="_blank">HTML Applications Introduction</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms536473%28VS.85%29.aspx" target="_blank">HTA Reference</a></li>
<li><a href="http://www.amazon.com/gp/product/0735622442?ie=UTF8&#038;tag=cheesymovieni-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0735622442" target="_blank">Advanced VBScript for Microsoft  Windows  Administrators (Book)</a><img src="http://www.assoc-amazon.com/e/ir?t=cheesymovieni-20&#038;l=as2&#038;o=1&#038;a=0735622442" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
</ul>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.northatlantawebdesign.com/index.php/2009/07/17/hta-progress-bar-using-vbscript-and-javascript/')" href="http://www.sphere.com/search?q=sphereit:http://www.northatlantawebdesign.com/index.php/2009/07/17/hta-progress-bar-using-vbscript-and-javascript/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.northatlantawebdesign.com/index.php/2009/07/17/hta-progress-bar-using-vbscript-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple VBScript Progress Bar</title>
		<link>http://www.northatlantawebdesign.com/index.php/2009/07/16/simple-vbscript-progress-bar/</link>
		<comments>http://www.northatlantawebdesign.com/index.php/2009/07/16/simple-vbscript-progress-bar/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 17:26:17 +0000</pubDate>
		<dc:creator>Jeff Gibeau</dc:creator>
				<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Progress Bar]]></category>

		<guid isPermaLink="false">http://www.northatlantawebdesign.com/?p=69</guid>
		<description><![CDATA[Recently I had a need for a simple progress bar written in VBScript to let users know what was going on in a multi-step application. To my surprise, VBScript has nothing built in for a progress bar.  After much searching, I was able to find this thread that linked to yet another thread with a [...]]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><p>Recently I had a need for a simple progress bar written in <a type="amzn">VBScript</a> to let users know what was going on in a multi-step application.  To my surprise, VBScript has nothing built in for a progress bar.  After much searching, I was able to find <a title="Copy Files with Progress Bar" href="http://www.tek-tips.com/viewthread.cfm?qid=1196550&amp;page=1">this thread</a> that linked to yet <a title="Adding some kind of progress" href="http://www.tek-tips.com/viewthread.cfm?qid=898604">another thread</a> with a simple progress bar done in HTML using InternetExplorer.Application.  I have taken this code and modified it to show an actual progess bar, with percentages, that can be updated as desired.  I&#8217;ve wrapped it up in a nice easy-to-use class for reusability.  Enjoy!</p>
<p><span id="more-69"></span></p>
<div id="attachment_82" class="wp-caption aligncenter" style="width: 322px"><img class="size-full wp-image-82" title="Simple VBScript Progress Bar" src="http://www.northatlantawebdesign.com/wp-content/uploads/2009/07/vbscript_progress_bar.gif" alt="Simple VBScript Progress Bar" width="312" height="99" /><p class="wp-caption-text">Simple VBScript Progress Bar</p></div>
<p>VBScript Progress Bar Class:</p>
<pre class="brush: vb;">
Class ProgressBar
Private m_PercentComplete
Private m_CurrentStep
Private m_ProgressBar
Private m_Title
Private m_Text
Private m_StatusBarText

'Initialize defaults
Private Sub ProgessBar_Initialize
m_PercentComplete = 0
m_CurrentStep = 0
m_Title = &quot;Progress&quot;
m_Text = &quot;&quot;
End Sub

Public Function SetTitle(pTitle)
m_Title = pTitle
End Function

Public Function SetText(pText)
m_Text = pText
End Function

Public Function Update(percentComplete)
m_PercentComplete = percentComplete
UpdateProgressBar()
End Function

Public Function Show()
Set m_ProgressBar = CreateObject(&quot;InternetExplorer.Application&quot;)
'in code, the colon acts as a line feed
m_ProgressBar.navigate2 &quot;about:blank&quot; : m_ProgressBar.width = 315 : m_ProgressBar.height = 40 : m_ProgressBar.toolbar = false : m_ProgressBar.menubar = false : m_ProgressBar.statusbar = false : m_ProgressBar.visible = True
m_ProgressBar.document.write &quot;&lt;body Scroll=no style='margin:0px;padding:0px;'&gt;&lt;div style='text-align:center;'&gt;&lt;span name='pc' id='pc'&gt;0&lt;/span&gt;&lt;/div&gt;&quot;
m_ProgressBar.document.write &quot;&lt;div id='statusbar' name='statusbar' style='border:1px solid blue;line-height:10px;height:10px;color:blue;'&gt;&lt;/div&gt;&quot;
m_ProgressBar.document.write &quot;&lt;div style='text-align:center'&gt;&lt;span id='text' name='text'&gt;&lt;/span&gt;&lt;/div&gt;&quot;
End Function

Public Function Close()
m_ProgressBar.quit
m_ProgressBar = Nothing
End Function

Private Function UpdateProgressBar()
If m_PercentComplete = 0 Then
m_StatusBarText = &quot;&quot;
End If
For n = m_CurrentStep to m_PercentComplete - 1
m_StatusBarText = m_StatusBarText &amp; &quot;|&quot;
m_ProgressBar.Document.GetElementById(&quot;statusbar&quot;).InnerHtml = m_StatusBarText
m_ProgressBar.Document.title = n &amp; &quot;% Complete : &quot; &amp; m_Title
m_ProgressBar.Document.GetElementById(&quot;pc&quot;).InnerHtml = n &amp; &quot;% Complete : &quot; &amp; m_Title
wscript.sleep 10
Next
m_ProgressBar.Document.GetElementById(&quot;statusbar&quot;).InnerHtml = m_StatusBarText
m_ProgressBar.Document.title = m_PercentComplete &amp; &quot;% Complete : &quot; &amp; m_Title
m_ProgressBar.Document.GetElementById(&quot;pc&quot;).InnerHtml = m_PercentComplete &amp; &quot;% Complete : &quot; &amp; m_Title
m_ProgressBar.Document.GetElementById(&quot;text&quot;).InnerHtml = m_Text
m_CurrentStep = m_PercentComplete
End Function

End Class
</pre>
<p>Example of Usage:</p>
<pre class="brush: vb;">
'Declare progressbar and percentage complete
Dim pb
Dim percentComplete
'Setup the initial progress bar
Set pb = New ProgressBar
percentComplete = 0
pb.SetTitle(&quot;Step 1 of 5&quot;)
pb.SetText(&quot;Copying bin/Debug Folder&quot;)
pb.Show()

'Loop to update the percent complete of the progress bar
'Just add the pb.Update in your code to update the bar
'Text can be updated as well by pb.SetText
Do While percentComplete &lt;= 100
wscript.sleep 500
pb.Update(percentComplete)
percentComplete = percentComplete + 10
Loop
wscript.sleep 3000

'This shows how you can use the code for multiple steps
'In a future iteration I will add a second bar to measure overall progress
percentComplete = 0
pb.SetTitle(&quot;Step 2 of 5&quot;)
pb.SetText(&quot;Copying bin/Release Folder&quot;)
pb.Update(percentComplete)
Do While percentComplete &lt;= 100
wscript.sleep 500
pb.Update(percentComplete)
percentComplete = percentComplete + 10
Loop
pb.Close()
wscript.quit
</pre>
<p>In a future release, I may add another progress bar to keep track of the steps that are completed.  Feel free to use and modify this code as you desire.</p>
<p>Useful Links:</p>
<ul>
<li><a title="Microsoft VBScript Reference" href="http://msdn.microsoft.com/en-us/library/d1wf56tt%28VS.85%29.aspx">Microsoft VBScript Reference</a></li>
<li><a title="W3Schools VBScript Reference" href="http://www.w3schools.com/Vbscript/default.asp">W3Schools VBScript Reference</a></li>
<li><a title="Copy Files with a Progress Bar" href="http://www.tek-tips.com/viewthread.cfm?qid=1196550&amp;page=1">Copy Files with a Progress Bar</a></li>
</ul>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.northatlantawebdesign.com/index.php/2009/07/16/simple-vbscript-progress-bar/')" href="http://www.sphere.com/search?q=sphereit:http://www.northatlantawebdesign.com/index.php/2009/07/16/simple-vbscript-progress-bar/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.northatlantawebdesign.com/index.php/2009/07/16/simple-vbscript-progress-bar/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
