|
Answer» Hello all,
This is my first time posting here. I have been googling this non-stop and I can't seem to find anything to make a batch file do what I want it to do, so I figured i'd ask you gentlemen.
My goal is to (through a batch file) open Microsoft Outlook's Global Address List preferably for a specific user.
Right now all that I have is start outlook.exe, which opens outlook to the main screen.
Inside outlook there is a search bar ALONG the top, if I could get this batch program to insert a pre-defined username into that box and then press enter- that would do EXACTLY what I need it to do.
Does anyone KNOW if this is possible via batch? Or if not that way, is there any other way to achieve my goal?
Thank you all in advance for any help. A MUCH better way to do this would be through a VBscript. I'll try to work one up.Here is the VBscript for this. I am not a VBscripter by any definition of the term, but I know enough to get by. There may be some others on this board who can clean this script up, but it gets the job done that you are looking to get done. Type this out in notepad and save it as "VBOutlook.vbs" (or something similar, but with the .vbs extension.)
Code: [Select]On Error Resume Next dim WshShell,oArgs
set oArgs=wscript.Arguments
sName=oArgs(0)
set WshShell = WScript.CreateObject("WScript.Shell")
rc=WshShell.Run("cmd", 2, FALSE) Wscript.Sleep 1000 WshShell.AppActivate(cmd.exe) WshShell.SendKeys CHR(34) & "c:\Program Files\Microsoft Office\Office12\outlook.exe" & CHR(34) & VBCRLF WshShell.AppActivate(cmd.exe) WshShell.SendKeys "exit" & VBCRLF Wscript.Sleep 1000 WshShell.AppActivate(outlook.exe) Wscript.Sleep 10000 WshShell.SendKeys "+^b" Wscript.Sleep 1000 WshShell.SendKeys sName
set WshShell=Nothing set oArgs=Nothing
Open the cmd prompt to the location of the script and type
Code: [Select]cscript VBOutlook.vbs Name
The sleeps are delays in milliseconds. I put in some LENGTHY delays because I know sometimes outlook doesn't like to open fast for me. You can adjust these numbers to suit your needs.Thanks for the help. I guess it just isn't possible from batch then, maybe I can have my batch script call this vbs. If I could make it transition smoothly this might work. Thank you very much for the script , I will use this as a launching point to figure out if I can make this work or not.
|