Tuesday, November 11, 2008

Super flexible Browser Helper Object that runs vbscript

A gift for all you Vbscripters, your very own Browser Helper Object (BHO). If you're not up to speed on BHO's then checkout the wiki on the subject. The reason this BHO is for Vbscripters is that I've already implemented the plumbing. I've created the BHO but I left it wide open to you to add your own code! Really quite exciting if you are creative and consider the possibilities. BHOs enable you to control the behavior of Internet Explorer and are normally only available to C++, VB, .NET and 'real' programming languages. Using my little BHO, which by the way is named BHO.VBS, you can simply write a script similiar to this... if strcomp(mydoc.url,"http://www.google.com/",1)=0 then set strQ=myDoc.GetElementByID("q") strQ.value="FrontierDG" end if Can you guess what the script does? This script will put the text 'FrontierDG' in the Google search textbox. Pretty neat, huh? Well hopefully you are anxious to try your hand at creating your own script so let's get started. Here's a list of what you need to do... 1. Download my BHO.dll and Input.vbs.

2. Run regsvr32 on the BHO.dll to register the dll.

3. Search for the CLSID of BHO.VBS in the Windows registry.

4. Add the CLSID to the Browser Helper Object section of the Windows registry.

Step 1. Download my BHO.dll and Input.vbs

Download both here. Extract both to a folder somewhere on your computer. The files need to stay together because BHO.dll will 'look' for Input.vbs in the same folder as it is located.

2. Run regsvr32 on the BHO.dll to register the dll.

Ok, once you download and extract the files you need to register the dll. You do this by typing...

regsvr32 c:\path\to\dll\bho.dll and pressing the Enter key. If all went well you'll see dialog that dll succeeded. If it failed write me a note and I'll help.

3. Search the CLSID for our BHO.VBS in the Windows registry.

Fire up Regedit and highlight HKEY_CLASSES_ROOT section, then CTRL+F and search for BHO.VBS. Click the '+' sign next to BHO.VBS and below you should see Clsid. You need to copy the default value of the Clsid it should be this...

{BA57180D-B7DD-418A-A102-65D400315C86}

Copy everything including the curly brackets and more on to step 4.

4. Add the CLSID to the Browser Helper Object section of the Windows registry.

Ok, now you've got to add a key in Browser Helper Object of the Windows registry. In regedit browse to... HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects

and enter new key with the Clsid of the BHO.VBS file (remember from step 3).

Whew, you made it. Pat yourself on the back. Now let's see if it is working. In the Internet Explorer address bar type http://www.google.com/ and press enter. When the Google page appears the search box should have a special message just for you ;)

Now all you need to do modify the behavior of BHO.VBS is modify the Input.vbs file. Start making your own creative changes!

Oh, one more thing. A lot of BHOs are related to adware, spyware, and the like. That doesn't mean that all BHOs are bad. After all Microsoft, Yahoo, Google, and Adobe provide BHOs that are a welcome part of most peoples' Internet Explorer experience.

Still I wanted to provide some safeguard against abuse of BHO.VBS, so every so often a small Windows will appear in the lower right hand corner of the screen that BHO.VBS is running and a link to this blog.

If this is a problem contact me and we can discuss.

Enjoy! :)

No comments:

Post a Comment