<?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>Fullyreloaded Blog &#187; vbscript</title>
	<atom:link href="http://blog.fullyreloaded.com/tag/vbscript/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.fullyreloaded.com</link>
	<description>reload your mind</description>
	<lastBuildDate>Fri, 23 Apr 2010 07:11:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Compare Folder Script</title>
		<link>http://blog.fullyreloaded.com/compare-folder-script</link>
		<comments>http://blog.fullyreloaded.com/compare-folder-script#comments</comments>
		<pubDate>Wed, 31 Dec 2008 01:52:11 +0000</pubDate>
		<dc:creator>Lucky Adibrata</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips and Trick]]></category>
		<category><![CDATA[compare folder]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://blog.fullyreloaded.com/?p=332</guid>
		<description><![CDATA[Today I created a script to compare the contents of two folder including its subfolders. It&#8217;s a simple solution if you don&#8217;t want to buy folder comparator software, but the script will not compare the content of the file, it only compares the file size and last modified date.

Click read more to see the script

The [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Today I created a script to compare the contents of two folder including its subfolders. It&#8217;s a simple solution if you don&#8217;t want to buy folder comparator software, but the script will not compare the content of the file, it only compares the file size and last modified date.</p>
<p><a href="http://blog.fullyreloaded.com/wp-content/uploads/2008/12/compare-script.jpg"><img src="http://blog.fullyreloaded.com/wp-content/uploads/2008/12/compare-script-300x151.jpg" alt="compare-script" title="compare-script" width="300" height="151" class="aligncenter size-medium wp-image-333" /></a></p>
<p>Click read more to see the script<br />
<span id="more-332"></span></p>
<p><strong>The Script</strong></p>
<pre lang="vbscript" line="1">
' -------------------------------
' Name    : Compare Folder Script
' Version : 1.0
' Author  : Lucky
' -------------------------------

WScript.Echo "Compare Folder Script v1.0 by Lucky"
WScript.Echo "==================================="
WScript.Echo

Dim args
Set args = WScript.Arguments

Dim folder1
Dim folder2
Dim hideok

If args.Count<>3 Then
    WScript.Echo "Usage: cscript compare.vbs [folder1] [folder2] [hideok]"
    WScript.Quit()
Else
    folder1=args(0)
    folder2=args(1)
    If LCase(args(2)) = "yes" Then
        hideok = True
    Else
    	  hideok = False
    End If
    WScript.Echo "Compare """ &#038; args(0) &#038; """ and """ &#038; args(1) &#038; """:"
    WScript.Echo
End If

'Start compare
Function comparefolder(folder1,folder2,hideok)
	Dim fso,f1

	Set fso = CreateObject("Scripting.FileSystemObject")
	Set f1 = fso.GetFolder(folder1)
	Set f2 = fso.GetFolder(folder2)

	'Check on first folder
	Set colFiles = f1.Files
	For Each objFile in colFiles
	    cmpFileName = fso.BuildPath(f2.Path, objFile.Name)

	    If fso.FileExists(cmpFileName) Then
	        Set objFile2 = fso.GetFile(cmpFileName)
                IsOk= True
	        If objFile.Size <> objFile2.Size Then
	            WScript.Echo objFile.Path + ": Different file size (" + CStr(objFile.Size) + " and " + CStr(objFile2.Size) + ")"
                    IsOk = False
	        End If
	        If objFile.DateLastModified <> objFile2.DateLastModified Then
	            WScript.Echo objFile.Path + ": Different modified date (" + CStr(objFile.DateLastModified) + " and " + CStr(objFile2.DateLastModified) + ")"
                    IsOk = False
                End If
	        If Not hideok And IsOk Then
	            WScript.Echo objFile.Path + ": OK"
	        End If
	    Else
	        WScript.Echo cmpFileName + ": file didn't exist"
	    End If
	Next

	'Check on second folder
	Set colFiles = f2.Files
	For Each objFile in colFiles
	    cmpFileName = fso.BuildPath(f1.Path, objFile.Name)

	    If Not fso.FileExists(cmpFileName) Then
	        WScript.Echo cmpFileName + ": file didn't exist"
	    End If
	Next

	'Check on first folder sub
	Set colFolders = f1.SubFolders
	For Each objFolder in colFolders
	    cmpFolderName = fso.BuildPath(f2.Path, objFolder.Name)

	    If fso.FolderExists(cmpFolderName) Then
          Call comparefolder(objFolder.Path,cmpFolderName,hideok)
	    Else
	        WScript.Echo cmpFolderName + ": folder didn't exist"
	    End If

	Next

	'Check on second folder sub
	Set colFolders = f2.SubFolders
	For Each objFolder in colFolders
	    cmpFolderName = fso.BuildPath(f1.Path, objFolder.Name)

	    If Not fso.FolderExists(cmpFolderName) Then
	        WScript.Echo cmpFolderName + ": folder didn't exist"
	    End If

	Next
End Function

Call comparefolder(folder1,folder2,hideok)

WScript.Quit()
</pre>
<p><strong>Usage</strong><br />
Copy the script above and save it to file named &#8220;compare.vbs&#8221;.</p>
<pre lang="dos">
Syntax:
cscript compare.vbs [folder1] [folder2] [hideok]

Examples:
Compare folder named "folder1" to "folder2" and hide indentical file.
cscript compare.vbs "folder1" "folder2" yes

Compare folders and save the report to file
cscript compare.vbs "folder1" "folder2" no > differences.txt
</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.fullyreloaded.com/compare-folder-script/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rename Multiple File with Regex Script</title>
		<link>http://blog.fullyreloaded.com/rename-multiple-file-with-regex-script</link>
		<comments>http://blog.fullyreloaded.com/rename-multiple-file-with-regex-script#comments</comments>
		<pubDate>Wed, 24 Dec 2008 07:36:55 +0000</pubDate>
		<dc:creator>Lucky Adibrata</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips and Trick]]></category>
		<category><![CDATA[filename]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[rename]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://blog.fullyreloaded.com/?p=320</guid>
		<description><![CDATA[Since Windows rename command doesn&#8217;t support regular expression, so today I made a VB Script to batch rename multiple files using regex method.

What is Regular Expression?
Basically, a regular expression is a pattern describing a certain amount of text. Their name comes from the mathematical theory on which they are based. But we will not dig [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Since Windows rename command doesn&#8217;t support regular expression, so today I made a VB Script to batch rename multiple files using regex method.</p>
<p><a href="http://blog.fullyreloaded.com/wp-content/uploads/2008/12/rename-script.jpg"><img src="http://blog.fullyreloaded.com/wp-content/uploads/2008/12/rename-script-300x151.jpg" alt="rename-script" title="rename-script" width="300" height="151" class="aligncenter size-medium wp-image-321" /></a></p>
<p><strong>What is Regular Expression?</strong><br />
Basically, a regular expression is a pattern describing a certain amount of text. Their name comes from the mathematical theory on which they are based. But we will not dig into that. Since most people including myself are lazy to type, you will usually find the name abbreviated to regex or regexp. I prefer regex, because it is easy to pronounce the plural &#8220;regexes&#8221;.</p>
<p>Click read more to see the script<br />
<span id="more-320"></span></p>
<p><strong>The Script</strong></p>
<pre lang="vbscript" line="1">
' ----------------------------------
' Name    : Regex Rename File Script
' Version : 1.0
' Author  : Lucky
' ----------------------------------

WScript.Echo "Rename File Script v1.0 by Lucky"
WScript.Echo "================================"
WScript.Echo

Dim args
Set args = WScript.Arguments

Dim pattern
Dim replacement

If args.Count<>2 Then
    WScript.Echo "Usage: cscript rename.vbs [searchpattern] [replacement]"
    WScript.Quit()
Else
    pattern=args(0)
    replacement=args(1)
    WScript.Echo "Replace """ &#038; args(0) &#038; """ to """ &#038; args(1) &#038; """:"
    WScript.Echo
End IF

'Start rename
Dim fso,cf,regex
Dim oldname,newname
Dim matches

Set fso = CreateObject("Scripting.FileSystemObject")
Set cf = fso.GetFolder(".")
Set regex = New RegExp
regex.Pattern=pattern
regex.IgnoreCase=True

Set colFiles = cf.Files
For Each objFile in colFiles
    oldname=objFile.Name
    Set matches = regex.Execute(oldname)
    If matches.Count>0 Then
        newname=regex.Replace(oldname,replacement)
        Wscript.Echo "Rename """ &#038; oldname &#038; """ to """ &#038; newname &#038; """"
        objFile.Move newname
    End If

Next
</pre>
<p><strong>Usage</strong><br />
First you need to copy the script above and paste it on notepad, save it to &#8220;rename.vbs&#8221;. Regex rename script needs two parameters, pattern and replacement. The script will find matching filename with the pattern in current folder, and replace it to replacement text.</p>
<pre lang="dos">
Usage: cscript rename.vbs [searchpattern] [replacement]
</pre>
<p><strong>Examples</strong><br />
You can use a few examples with the script</p>
<pre lang="dos">
#simply rename a file from image.jpg to image2.jpg
cscript rename.vbs image.jpg image2.jpg

#rename some file with wildcards, image?.jpg to picture?.jpg
cscript rename.vbs image(.).jpg picture$1.jpg

#another example with wildcards, rename file start with image to picture
cscript rename.vbs image(.*) picture$1
</pre>
<p><strong>Limitation</strong><br />
Currently the latest VBScript version 5.5 regular expression engine has some limitation, which are:</p>
<ul>
<li>No \A or \Z anchors to match the start or end of the string. Use a caret or dollar instead</li>
<li>Lookbehind is not supported at all. Lookahead is fully supported</li>
<li>No atomic grouping or possessive quantifiers</li>
<li>No Unicode support, except for matching single characters with \uFFFF</li>
<li>No named capturing groups. Use numbered capturing groups instead</li>
<li>No mode modifiers to set matching options within the regular expression</li>
<li>No conditionals</li>
<li>No regular expression comments. Describe your regular expression with VBScript apostrophe comments instead, outside the regular expression string</li>
</ul>
<p>Source: <a href="http://www.regular-expressions.info/vbscript.html">Regular-Expression.info</a></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.fullyreloaded.com/rename-multiple-file-with-regex-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read/Write ID3Tag from MP3 with VB Script</title>
		<link>http://blog.fullyreloaded.com/readwrite-id3tag-from-mp3-with-vb-script</link>
		<comments>http://blog.fullyreloaded.com/readwrite-id3tag-from-mp3-with-vb-script#comments</comments>
		<pubDate>Mon, 22 Dec 2008 03:27:02 +0000</pubDate>
		<dc:creator>Lucky Adibrata</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[cddbcontrol]]></category>
		<category><![CDATA[id3tag]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wma]]></category>

		<guid isPermaLink="false">http://blog.fullyreloaded.com/?p=283</guid>
		<description><![CDATA[I&#8217;ve found the way to read/write ID3Tag from MP3 files with VB Script.

Requirement
In order to run the script, you must first download the CDDBControl.dll library file. You can download it here.
Note: it also support WMA format
Click read more to see details.

Installation
After you downloaded it, extract to C:\Windows\System32, and run this command:

C:\Windows\System32\regsvr32 CDDBControl.dll

The Script
Here is an [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve found the way to read/write ID3Tag from MP3 files with VB Script.</p>
<p><a href="http://blog.fullyreloaded.com/wp-content/uploads/2008/12/read-id3tag-vbscript.jpg"><img src="http://blog.fullyreloaded.com/wp-content/uploads/2008/12/read-id3tag-vbscript-300x151.jpg" alt="read-id3tag-vbscript" title="read-id3tag-vbscript" width="300" height="151" class="aligncenter size-medium wp-image-286" /></a></p>
<p><strong>Requirement</strong><br />
In order to run the script, you must first download the CDDBControl.dll library file. You can download it <a href="http://www.helpy.com.ar/dll/c/CDDBControl.zip">here</a>.</p>
<p>Note: it also support WMA format</p>
<p>Click read more to see details.<br />
<span id="more-283"></span></p>
<p><strong>Installation</strong><br />
After you downloaded it, extract to C:\Windows\System32, and run this command:</p>
<pre lang="dos">
C:\Windows\System32\regsvr32 CDDBControl.dll
</pre>
<p><strong>The Script</strong><br />
Here is an example vb script to read mp3 and wma files in current folder.</p>
<pre lang="vbscript" line="1">
'Read ID3Tags
Sub ReadID3Tags(folderPath)
  'create FileSystemObject instance
  Dim fso
  Set fso = CreateObject("Scripting.FileSystemObject")
  Dim folder
  Set folder = fso.GetFolder(folderPath)
  Dim thefile,ext
  Dim id3obj
  Set id3obj = CreateObject("CDDBControl.CddbID3Tag")

  'enumerate files in the folder
  For Each thefile In folder.Files
    'select only mp3 And wma files
    ext = LCase(Right(thefile.Name, 4))
    If ext=".mp3" Or ext=".wma" Then
      'load file
      id3obj.LoadFromFile thefile.Path, True 'set false if you want to read
      WScript.Echo thefile.Name
      WScript.Echo "Album		: " &#038; id3obj.Album
      WScript.Echo "Movie		: " &#038; id3obj.Movie
      WScript.Echo "Title		: " &#038; id3obj.Title
      WScript.Echo "CopyrightYear	: " &#038; id3obj.CopyrightYear
      WScript.Echo "CopyrightHolder	: " &#038; id3obj.CopyrightHolder
      WScript.Echo "Comments	: " &#038; id3obj.Comments
      WScript.Echo "Label		: " &#038; id3obj.Label
      WScript.Echo "BeatsPerMinute	: " &#038; id3obj.BeatsPerMinute
      WScript.Echo "LeadArtist	: " &#038; id3obj.LeadArtist
      WScript.Echo "PartOfSet	: " &#038; id3obj.PartOfSet
      WScript.Echo "TrackPosition	: " &#038; id3obj.TrackPosition
      WScript.Echo "Year		: " &#038; id3obj.Year
      WScript.Echo "Genre		: " &#038; id3obj.Genre
      WScript.Echo "FileId		: " &#038; id3obj.FileId
      WScript.Echo "ISRC		: " &#038; id3obj.ISRC
      WScript.Echo
    End If
  Next
End Sub

'Call the function
ReadID3Tags(".")
</pre>
<p><strong>Usage</strong><br />
Save the script above, save it to readid3files.vbs, put it on a folder where you keep your mp3 files. Run the command below:</p>
<pre lang="dos">
cscript readid3files.vbs
</pre>
<p><strong>Another Functions</strong><br />
Here is full list functions of the library.</p>
<pre lang="dos">
Interfaces:
Interface ICddbID3Tag
GUID: {0306D2A8-B7E2-4EA2-ADC6-78F80D65B1E2}
HelpString: ICddbID3Tag Interface
# Members: Sub QueryInterface(riid as GUID, ppvObj as Void)
# Function AddRef as VT_UI4
# Function Release as VT_UI4
# Sub GetTypeInfoCount(pctinfo as VT_UINT)
# Sub GetTypeInfo(itinfo as VT_UINT, lcid as VT_UI4, pptinfo as Void)
# Sub GetIDsOfNames(riid as GUID, rgszNames as VT_I1, cNames as VT_UINT, lcid as VT_UI4, rgdispid as Long)
# Sub Invoke(dispidMember as Long, riid as GUID, lcid as VT_UI4, wFlags as VT_UI2, pdispparams as DISPPARAMS, pvarResult as Variant, pexcepinfo as EXCEPINFO, puArgErr as VT_UINT)
# Property Get Album as String [property Album]
# Property Put Album as String [property Album]
# Property Get Movie as String [property Movie]
# Property Put Movie as String [property Movie]
# Property Get Title as String [property Title]
# Property Put Title as String [property Title]
# Property Get CopyrightYear as String [property CopyrightYear]
# Property Put CopyrightYear as String [property CopyrightYear]
# Property Get CopyrightHolder as String [property CopyrightHolder]
# Property Put CopyrightHolder as String [property CopyrightHolder]
# Property Get Comments as String [property Comments]
# Property Put Comments as String [property Comments]
# Property Get Label as String [property Label]
# Property Put Label as String [property Label]
# Property Get BeatsPerMinute as String [property BeatsPerMinute]
# Property Put BeatsPerMinute as String [property BeatsPerMinute]
# Property Get LeadArtist as String [property LeadArtist]
# Property Put LeadArtist as String [property LeadArtist]
# Property Get PartOfSet as String [property PartOfSet]
# Property Put PartOfSet as String [property PartOfSet]
# Property Get TrackPosition as String [property TrackPosition]
# Property Put TrackPosition as String [property TrackPosition]
# Property Get Year as String [property Year]
# Property Put Year as String [property Year]
# Property Get Genre as String [property Genre]
# Property Put Genre as String [property Genre]
# Property Get FileId as String [property FileId]
# Property Put FileId as String [property FileId]
# Property Get ISRC as String [property ISRC]
# Property Put ISRC as String [property ISRC]
# Sub LoadFromFile(Filename as String, Readonly as Long) [method LoadFromFile]
# Sub BindToFile(Filename as String, Readonly as Long) [method BindToFile]
# Sub SaveToFile(Filename as String) [method SaveToFile]
# Sub Commit [method Commit]
# Sub Clear [method Clear]
# Sub LoadFromBuffer(Buffer as Variant, BufferSize as Long) [method LoadFromBuffer]
# Function GetBufferSize as Long [method GetBufferSize]
# Sub SaveToBuffer(Buffer as Variant, BufferSize as Long) [method SaveToBuffer]
# Function GetTextFrame(Frame as String) as String [method GetTextFrame]
# Sub SetTextFrame(Frame as String, Text as String) [method SetTextFrame]
</pre>
<p>Source: <a href="http://www.motobit.com/tips/detpg_change-id3-tags-script/">Motobit</a></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.fullyreloaded.com/readwrite-id3tag-from-mp3-with-vb-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Virtual Servers on IIS (Windows XP Pro)</title>
		<link>http://blog.fullyreloaded.com/multiple-virtual-servers-on-iis-windows-xp-pro</link>
		<comments>http://blog.fullyreloaded.com/multiple-virtual-servers-on-iis-windows-xp-pro#comments</comments>
		<pubDate>Thu, 18 Dec 2008 17:48:15 +0000</pubDate>
		<dc:creator>Lucky Adibrata</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips and Trick]]></category>
		<category><![CDATA[adminscript]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[virtual server]]></category>

		<guid isPermaLink="false">http://blog.fullyreloaded.com/?p=255</guid>
		<description><![CDATA[Microsoft Windows XP Pro has built in Web Server called Internet Information Service (IIS). In order to use the feature, make sure your IIS service already activated:

Right click on My Computer, choose Manage
Expand tree Services and Applications
If you see Internet Information Services item, then your IIS service is already installed

IIS Installation
To install IIS Service, follow [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Microsoft Windows XP Pro has built in Web Server called Internet Information Service (IIS). In order to use the feature, make sure your IIS service already activated:</p>
<ul>
<li>Right click on My Computer, choose Manage</li>
<li>Expand tree Services and Applications</li>
<li>If you see Internet Information Services item, then your IIS service is already installed</li>
</ul>
<p><strong>IIS Installation</strong><br />
To install IIS Service, follow these instructions to activate it:</p>
<ul>
<li>Go to Control Panel > Add or Remove Programs</li>
<li>Open Add/Remove Windows Components, tick on Internet Information Services (IIS)</li>
<li>Click Next button until it finished</li>
</ul>
<p><img src="http://blog.fullyreloaded.com/wp-content/uploads/2008/12/multiple-virtual-server-300x159.jpg" alt="multiple-virtual-server" title="multiple-virtual-server" width="300" height="159" class="aligncenter size-medium wp-image-266" /></p>
<p><strong>Create a Virtual Server</strong><br />
Check on the Web Sites folder in IIS management console, you may see only &#8220;Default Web Site&#8221;. If you are a web developer, sometime you need to have another separate web servers. Of course you can also mount a virtual directory to the server, but it will never have root path.</p>
<p><span id="more-255"></span></p>
<p>Now you can add another virtual servers which have it&#8217;s own root path. IIS have a collection of scripts for administrative tasks such as creating another virtual servers. You can found the scripts on <code>C:\Inetpub\AdminScripts</code>, to create a virtual server we can use script file adsutil.vbs. For details, follow instructions below:</p>
<ul>
<li>Open command prompt, click on Start menu > Run, type cmd and press enter</li>
<li>Go to the scripts folder, type &#8220;cd \Inetpub\AdminScripts&#8221;</li>
<li>Create new virtual server and copy all the necessary settings using these commands
<pre lang="dos">
 cscript adsutil.vbs create_vserv W3SVC/2
 cscript adsutil.vbs copy W3SVC/1 W3SVC/2
</pre>
</li>
<li>Now you should create a folder for the web&#8217;s home directory, for example <code>C:\Inetpub\wwwroot_secondary</code></li>
<li>Go back to IIS Management Console, you should see another Web inside Web Sites folder</li>
<li>If you see red icon for the new web, don&#8217;t worry it&#8217;s normal, Windows tried to start the second web, unfortunately you can only run one at a time</li>
<li>Rename it, right click on Second web, choose rename, type &#8220;Secondary Web&#8221; for example</li>
</ul>
<p><strong>Switch The Virtual Server</strong><br />
To switch the running server, you can make batch file running these command:</p>
<pre lang="dos">
enable_second_server.bat
cscript C:\Inetpub\AdminScripts\adsutil.vbs STOP_SERVER W3SVC/1
cscript C:\Inetpub\AdminScripts\adsutil.vbs START_SERVER W3SVC/2

enable_first_server.bat
cscript C:\Inetpub\AdminScripts\adsutil.vbs STOP_SERVER W3SVC/2
cscript C:\Inetpub\AdminScripts\adsutil.vbs START_SERVER W3SVC/1
</pre>
<p><strong>Delete a Virtual Server</strong><br />
To delete you previously created, use this command:</p>
<pre lang="dos">
C:\Inetpub\AdminScripts>cscript adsutil.vbs delete W3SVC/2
</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.fullyreloaded.com/multiple-virtual-servers-on-iis-windows-xp-pro/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grabbing Data from Web using VBScript/VBA</title>
		<link>http://blog.fullyreloaded.com/grabbing-data-from-web-using-vbscriptvba</link>
		<comments>http://blog.fullyreloaded.com/grabbing-data-from-web-using-vbscriptvba#comments</comments>
		<pubDate>Tue, 25 Nov 2008 18:11:37 +0000</pubDate>
		<dc:creator>Lucky Adibrata</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[grab data]]></category>
		<category><![CDATA[httprequest]]></category>
		<category><![CDATA[url request]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xmlhttp]]></category>

		<guid isPermaLink="false">http://blog.fullyreloaded.com/?p=55</guid>
		<description><![CDATA[You can grab data from web URL, here is 2 methods we can use.
1. Using IE Instance
The first method using IE instance
pros:

No need to install
You can see the progress by uncomment set visible line

cons:

IE doesnt have method to let you wait until finish, so you must check in a loop
IE takes more memory than other [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>You can grab data from web URL, here is 2 methods we can use.</p>
<p><strong>1. Using IE Instance</strong><br />
The first method using IE instance<br />
<em>pros:</em></p>
<ul>
<li>No need to install</li>
<li>You can see the progress by uncomment set visible line</li>
</ul>
<p><em>cons:</em></p>
<ul>
<li>IE doesnt have method to let you wait until finish, so you must check in a loop</li>
<li>IE takes more memory than other methods</li>
</ul>
<pre lang="vb" line="1">
Function IEGetRequest(URL)
  'Create IE Instance
  Dim IeInstance

  Set IeInstance = CreateObject("InternetExplorer.Application")

  'Uncomment the next line to see IE window
  'IeInstance.Visible = True

  IeInstance.Navigate URL

  Do While IeInstance.Busy
    Wait 1, "Waiting " &amp; URL
  Loop

  'Get the response
  On Error Resume Next
  IEGetRequest = IeInstance.Document.Body.innerHTML
  IeInstance.Quit
End Function

Sub Wait(sec, msg)
  On Error Resume Next
  Dim Shell
  If IsEmpty(Shell) Then
    Set Shell = CreateObject("WScript.Shell")
  End If
  Shell.Popup msg, sec, "", 64
End Sub

' Test the function
MsgBox IEGetRequest("http://www.yahoo.com/")
</pre>
<p><span id="more-55"></span></p>
<p><strong>2. Using HttpRequest Object</strong><br />
The second method is using HttpRequest object. There are several objects we can use.</p>
<ol>
<li><em>XMLHTTP</em>. First http request object from Microsoft work with VBS/ASP/WSH. This object uses WinInet API (not suitable for use in ASP apps)</li>
<li><em>ServerXMLHTTP</em>. This object was created because of problems with XMLHTTP in server applications. It contains its own http engine, which is safe to use in server applications. The http engine has some small limitations (I think it does not enable client certificates, etc.), but the limitations has probably no impact to usual demands.</li>
<li><em>WinHTTP object</em>. Similar as ServerXMLHTTP You can find the object at http://msdn.microsoft.com, search for WinHTTP.</li>
</ol>
<p>My recomendation &#8211; use this object, if you can install it. MSXML 4.0 package uses this library also (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/sdk_dependencies_9po5.asp)</p>
<p>These three objects has almost the same OLE interface, so you can use the same source code.</p>
<pre lang="vb" line="1">
Function HttpGetRequest(URL)
  Dim req

  'Create request object, you can use one of these object
  Set req = CreateObject("MSXML2.XMLHTTP")
  'Set req = CreateObject("MSXML2.ServerXMLHTTP")
  'Set req = CreateObject("WinHttp.WinHttprequest.5")

  'Open URL as GET request, the third parameter means that it should wait until finish before continue
  req.Open "GET", URL, False

  'Send the request (we dont need to use the parameter)
  req.send vbNullString

  'Get the result string
  HttpGetRequest = req.responseText
End Function

'Test function
MsgBox HttpGetRequest("http://www.yahoo.com/")
</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.fullyreloaded.com/grabbing-data-from-web-using-vbscriptvba/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
