Using WSH Scripts with MSN Desktop Search

* Update - minor correction to @find shortcut posted *

 

I'm a great believer in "re-use but not repetition" and an avid fan of shortcuts that help me in my day-to-day work in front of the screen.  Recently I've been looking at how WSH scripts combined with MSN Desktop Search can be used to save even more time.  I thought I'd share three of my most used scripts…  To use these, copy the snippet to a .VBS file and register as a shortcut.  For example:

 

@find, =c:\myscripts\find.vbs $w

 

Here they are:

 

Finding contacts in Outlook

 

Frequently I want to search for contacts in the GAL - without having to ALT-TAB to Outlook, type the name in the address field etc.  Using this find WSH script I can just type:

 

find Bill Gates

 

…in the MSN Desktop Search toolbar to popup the contact from Outlook.  Here's the code snippet.

 

Set wShell = CreateObject("WScript.Shell")
wShell.AppActivate(" Microsoft Outlook")
WScript.Sleep 200
wShell.SendKeys("^+i")
WScript.Sleep 200
wShell.SendKeys("%c")
WScript.Sleep 100
wShell.SendKeys("{RIGHT}{RIGHT}{RIGHT}{RIGHT}{DOWN}")
WScript.Sleep 100
alias = WScript.Arguments.Item(0)
newAlias = Replace(alias,"+"," ")
wShell.SendKeys(newAlias & "{ENTER}")

 

Finding an address in Mappoint

 

You are on the phone and someone gives you an address - wouldn’t it be nice to just type this into MSN Desktop Search toolbar to display a map?  Now you can with this address WSH script:

 

addr 1 Microsoft Way Redmond WA

 

This launches the Mappoint MSN site with the requested address.  Here's the code:

 

Set wShell = CreateObject("WScript.Shell")

Dim statePresent
Dim street
Dim splitStreet(5)
Dim city
Dim state
statePresent = 0

arguments = Split(WScript.Arguments.Item(0),"+")

if Len(arguments(Ubound(arguments))) = 2 then
statePresent = 1
end if

splitStreet(0) = arguments(0)
For f = 1 to UBound(arguments) -1 - statePresent
splitStreet(f) = "+" & arguments(f)
Next
street = Join(splitStreet)

city = arguments(UBound(arguments) - statePresent )

state = "WA"
if (statePresent = 1) then
state = arguments(UBound(arguments))
end if

wShell.Exec("c:\Program Files\Internet Explorer\iexplore https://maps.msn.com/home.aspx?strt1=" & street & "&city1=" & city & "&stnm1=" & state)

 

Overloading the Run command

 

Finally, I needed a quick way of setting focus to the MSN Desktop Search bar.  Before using the toolbar to get the usual Windows Run dialog box displayed I used to press CTRL-ESC and then R.  To achieve the same with MSN Desktop Search, remove the Run command from the start menu and use this script to set focus to the MSN Desktop Search Window instead:

 

Set wShell = CreateObject("WScript.Shell")
wShell.SendKeys("^%m")