Sign in to follow this  
Followers 0
Kenixs

Auto login for Outlook to Exch using PRC over Http

2 posts in this topic

Hello everyone!

This is my first post in this forum and i like to thank autoit team for great software you created here. I found it easy to use especially for a noob like me.:)

I've been using hosted exchange email many years and couldn't find any solution to auto login to their exchange server when launching the Outlook. Since most of them are using basic authentication method, you have to enter the password everytime you try to connect, i found this very inconvience and when I first saw Autoit, I started thinking maybe I can make a simple Outlook starter script to auto plug in my password. So I made the following script doing just that, It works perfectly on my Vista machine with Outlook 2007. This is my first script using Autoit and I don't have any other programming language skill, I was wondering if there's a better way to achieve what I tried to do here in term of coding and method. I was happy that it actually run...:party:

#include "base64.au3"
#NoTrayIcon
Global $A
;Checking if the password file exist
$F = FileOpen( EnvGet("AppData") & "\Oal\Oal.data", 0)
If $F = -1 Then
    SP()
Else
    $A = FileReadLine($F,1)
EndIf
;Checking if Outlook is already running, if not have to launch outlook and login to exchange server.
If ProcessExists("OUTLOOK.EXE") Then
    LO()
    Exit
Else
    LO()
    Sleep(500)
    ProcessWait("OUTLOOK.EXE")
    WinWait("Connect to","",10)
    If WinExists("Connect to") Then
        WinActivate("Connect to")
        Send(StringTrimRight(BinaryToString(_Base64Decode($A)),stringlen(@UserName)))
        Send("{ENTER}")
    Endif
EndIf
Exit
Func SP()
    Do
        $P = InputBox("Initital Run", "Enter your Exchange server password.", "", "*") & @UserName
            If StringLen($P) < 8 + stringlen(@UserName) Then
                MsgBox(0,"Invalid password", "Must be at least 8 chars",1000)
            Endif
    Until StringLen($P) > 7 + stringlen(@UserName)

    $E = _Base64Encode($P)
    $F = FileOpen( EnvGet("AppData") & "\Oal\Oal.data", 10 )
    FileWriteLine($F,$E)
                FileClose($F)
    $A = $E

EndFunc
Func LO()
If ShellExecute("Outlook.exe","/recycle") = 0 Then
        MsgBox(0,"Error","Microsoft Office Outlook is not installed",1000)
        Exit
    EndIf
EndFunc

Share this post


Link to post
Share on other sites



Hey its seem you missed to post base64.au3 code until you don't provide its not possible to check :mellow:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0