Posts Tagged ‘vbscript’

Compare Folder Script

Wednesday, December 31st, 2008

Today I created a script to compare the contents of two folder including its subfolders. It’s a simple solution if you don’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.

compare-script

Click read more to see the script
(more…)

Rename Multiple File with Regex Script

Wednesday, December 24th, 2008

Since Windows rename command doesn’t support regular expression, so today I made a VB Script to batch rename multiple files using regex method.

rename-script

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 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 “regexes”.

Click read more to see the script
(more…)

Read/Write ID3Tag from MP3 with VB Script

Monday, December 22nd, 2008

I’ve found the way to read/write ID3Tag from MP3 files with VB Script.

read-id3tag-vbscript

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.
(more…)

Multiple Virtual Servers on IIS (Windows XP Pro)

Friday, December 19th, 2008

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 these instructions to activate it:

  • Go to Control Panel > Add or Remove Programs
  • Open Add/Remove Windows Components, tick on Internet Information Services (IIS)
  • Click Next button until it finished

multiple-virtual-server

Create a Virtual Server
Check on the Web Sites folder in IIS management console, you may see only “Default Web Site”. 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.

(more…)

Grabbing Data from Web using VBScript/VBA

Tuesday, November 25th, 2008

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 methods
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 " & 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/")

(more…)