Curious
(Getting the hang of it)
2010-03-19 04:32 PM
using sendkeys to add additional mailbox in outlook 2003

Hello.

I have looked around, trying to improve my auto-configuration for a new roaming profile in our Citrix-environment.

The auto-generation of the primary account to our exchange-server works perfect.

However: a few users need to set up an additional mailbox (or two).

I have "snapped" some code from one of the forums, and moderated it into norwegian, putting in some check in my primary script so that the right users run this script.

The script for this code is called by the call-command in kix.

 Code:
Break on 

$hklms = 'HKEY_LOCAL_MACHINE\Software'
$exe=ReadValue($hklms+"\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE","")
Shell($exe) ; -- Start Outlook
 Sleep 5


SetFocus ("Microsoft Outlook")
$=SendKeys("~e")
Sleep 1
$=SendKeys("e")
Sleep 1
$=SendKeys ("~V")
$=SendKeys ("n")
$=SendKeys("~E")
$=SendKeys("~F")
$=SendKeys("+{TAB}{RIGHT}")
$=SendKeys("~L")
$=SendKeys("SomeAccount1{ENTER}")
$=SendKeys("~L")
$=SendKeys("SomeAccount2{ENTER}")
$=SendKeys("~B")
$=SendKeys("{ENTER}")
$=SendKeys("n")
$=SendKeys("{ENTER}")



When Outlook already is open, this works perfectly, allthough it opens another window with outlook. This I can live with. But when I'm trying with my logon-script, it just freezes, nothing happens, exept outlook opens, and then the scripts doesn't work any more.

Have tried different ways to solve this, but not getting any further. Can somebody show me the light?

Regards /J


Richard H.Administrator
(KiX Supporter)
2010-03-19 04:59 PM
Re: using sendkeys to add additional mailbox in outlook 2003

Don't use SendKeys(), is is simply not robust enough for a task like this.

Use AutoIt instead. It is excellent for this type of work, and has a scriptabled DLL so you can use KiXtart for the coding if you don't want to write an AutoIt script.

AutoIt is free, and you can get it here


Radimus
(KiX Supporter)
2010-03-19 06:15 PM
Re: using sendkeys to add additional mailbox in outlook 2003

Why do you not use PRF files to configure outlook profiles...

http://office.microsoft.com/en-us/ork2003/HA011402581033.aspx


Curious
(Getting the hang of it)
2010-03-20 11:08 AM
Re: using sendkeys to add additional mailbox in outlook 2003

okey, mavbe I've got to look into auto-it. I'm not at all into that language, have you got some coding that can lead me into the right direction?

Radimus: I am using prf-files to set up all my users initial mailbox, but this is not available for users (not today anyway) that is in need of opening additional boxes.

Regards
/J


Radimus
(KiX Supporter)
2010-03-21 12:52 AM
Re: using sendkeys to add additional mailbox in outlook 2003

 Quote:

The Microsoft® Outlook® profile file (PRF file) allows you to quickly create MAPI profiles for Microsoft Office Outlook 2003 users. The PRF file is a text file with syntax that Microsoft Outlook uses to generate a profile. By using a PRF file, you can set up new profiles for users or modify existing profiles without affecting other aspects of your Outlook (or Microsoft Office) installation. You can also manually edit a PRF file to customize Outlook to include Outlook settings or MAPI services that are not included in the Custom Installation Wizard user interface.


Mart
(KiX Supporter)
2010-03-21 09:29 PM
Re: using sendkeys to add additional mailbox in outlook 2003

You might want to have a look at these two links.

Adding Additional mailboxes to the Outlook PRF file
How to add more Exchange mailboxes to a MAPI profile