Windows Tip: Scripting multiple Outlook windows
Send your Windows question to Mitch today! | See other Windows tips
Most knowledge workers in enterprise environments live by Microsoft Outlook. Email is so important for today's businesses that getting the most out of using Outlook is essential for job effectiveness.
One complaint I used to have about Outlook 2003 was that I could only open one copy of the program at a time. Double-click on the Outlook shortcut on the desktop, and an Outlook window opens. Double-click on the same shortcut again and nothing happens. This frustrates me because I could manage my email more efficiently if I could have multiple Outlook windows open, one displaying my general Inbox, another my Urgent folder where I route mail that's flagged as important, another my folder where I route mail for a big project I'm working on, and so on. It's great to be able to create rules in Outlook that will route incoming messages to whatever folders they should be directed, but I'd like to have these folders always visible on my desktop so I can easily see new messages arriving in each folder.
Then one day by accident I discovered that if I right-click on a folder in Outlook and select Open In New Window, a new copy of Outlook will open with the focus on this folder. My problem was solved! Well not quite -- it's tedious having to do this every time I log on and start Outlook.
So I wondered the other day if it might be possible to write a script that will open multiple Outlook windows with the focus on specific folders and arrange these windows on my desktop for easy viewing. After some research, I found that outlook.exe has a number of command-line options. One of these is the /select option, which lets you open Outlook with the focus on the folder you specify. A little VBScript does the rest:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "outlook.exe /select ""outlook:Calendar""",1,false
WshShell.Run "outlook.exe /select ""outlook:MTIT.COM\MVP Q&A""",1,false
WshShell.Run "outlook.exe /select ""outlook:MTIT.COM\IT World\Newsletters""",1,false
Wscript.Sleep 15000
Set objShell = CreateObject("Shell.Application")
objShell.TileVertically
This script does the following:
1. It uses WScript.Shell object's Run method to open three separate Outlook windows, one showing my Calendar, one a folder where I route the technical questions I often receive as a Microsoft MVP, and one where I route ITworld newsletters.
2. It then uses the Wscript.Sleep method to wait fifteen seconds to make sure all three Windows are open.
3. Finally, it uses the Shell.Application object's TileVertically method to arrange the three Outlook windows side-by side on my desktop.
By saving the script as MyOutlook.vbs and copying it into the Startup folder, the script runs every time I log on to my machine and my desktop looks like this.
A few caveats:
*Make sure Wscript.exe is your default script engine, otherwise a command-line window will remain open until the script finishes and as a result the windows won't be tiled properly. To make Wscript.exe your default script engine, open an admin-level command prompt and type cscript //h:wscript.
* Make sure your navigation pane is hidden in Outlook, otherwise your tiled windows will be messy and hard to view.
* If your desktop takes awhile to open because of various startup programs being loaded, you might need to increase the sleep statement to something longer like Wscript.Sleep 30000 to get the tiling to work.
Finally, if you have any questions concerning possible Windows tasks that you wonder whether they might be scriptable, or if you've written any useful scripts yourself that you'd like to share with other IT World readers, please feel free to email me your feedback anytime.
ITworld.com
Symantec Backup Exec 12 and Backup Exec System Recovery 8 deliver industry leading Windows data protection and system recovery. Download this whitepaper to find out the top reasons to upgrade and how to get continuous data protection and complete system recovery.
Data and system loss — from a hard drive failure, malicious attack, natural disaster, or simple human error — can happen anytime. Don’t leave your business vulnerable. Make sure you have a secure recovery strategy in place. Symantec's latest backup and system recovery technology can efficiently restore critical applications, individual emails and documents and even restore your entire system in minutes in the event of a loss.
Businesses face a growing challenge to ensure that the IT environment is properly protected. Backup Exec 12 integrates with other applications in the Symantec family of products, to complement your current data protection strategy, keep your data securely backed up and make it recoverable when you need it most.
Enterprise 2.0 Implementation
By Aaron C. Newman, Jeremy Thomas
Published by McGraw-Hill
Learn more!
Deploying Cisco Wide Area Application Services
By Zach Seils, Joel Christner
Published by Cisco Press
Learn more!








