Jump to content
Sign in to follow this  

Problem So Easy For U .. Stange For Me.

Recommended Posts



I am a newbie, obviously.

I am a serious newbie, as in i was just makde aware of AutoIT yesterday.

I have made a little script to fill in some detaisl i hae to manually enter as a sys admin on roaming profiles regarding ms mail settings in outlook. (thats right, i said ms mail).

I got my script to open outlook, install the ms mail patch, enter details, insert mailbox name based on username (or @username macro).

Im now at the stage where i need to enter the friendly user name, IE the display name in AD for the user, for example username:jsmith, displayname: John Smith.

I have a script that in VBScript can get me this value, but i cant find out how to do it in AutoIT, as in, i cant pass the variable to where i want to type it.

Heres my au3.

Run("c:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")
WinWaitActive("Inbox - Microsoft Outlook")

Send("{ALT}t, a, e, n, a, n, {ENTER}")
Send("{TAB 6}, {RIGHT}, {TAB}")
$cropped = stringLeft (@username, 2)
Send("{TAB}, {SPACE}, {TAB 4}, {RIGHT 3}, {TAB}, {SPACE}, {ENTER}, {ENTER}")

Now here is my vbscript code that will get me the displayname value from AD

set adSysInfo = createobject("ADSystemInfo")
set CurrentUser = getobject("LDAP://" & ADSysInfo.UserName)

wscript.echo Currentuser.displayname

I need to get the vbscript value "currentuser.displayname" into the autoIT script so i can "Send()" it to my outlook settings window.

PS: Here is my poor attempt to get it to work in AutoIT.

$objADS = ObjCreate("ADsystemInfo")
$objCurrentUser = objGet("LDAP://" & ADSysInfo.UserName)
$objDisplayName = $objCurrentUser.displayname


Thanks for all help, references, ideas, correction.

Thanks everyone.

Share this post

Link to post
Share on other sites

Check this post. Also JdeB made something like this. It is exactly what you wish for ;p Requires beta:

$oMyError = ObjEvent("AutoIt.Error", "ComError")
$UserObj = ObjGet("WinNT://" & @LogonDomain & "/" & @UserName)
If @error Then
    MsgBox(0, 'username', 'Error connecting to domain')
    MsgBox(0, 'username', $UserObj.FullName)
$UserObj = ""
$oMyError = ObjEvent("AutoIt.Error", "")
;COM Error function
Func ComError()
    If IsObj($oMyError) Then
        $HexNumber = Hex($oMyError.number, 8)
    Return 0
EndFunc ;==>ComError
Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Share this post

Link to post
Share on other sites

thank you very much, i got wot i need.


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.