Jump to content

Problem So Easy For U .. Stange For Me.


Recommended Posts

Hello,

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}")
Sleep(1000)
Send("\\Server\share\wgpo0001")
Sleep(100)
Send("{TAB 6}, {RIGHT}, {TAB}")
Sleep(1000)
Send(@USERNAME)
Send("{TAB}")
$cropped = stringLeft (@username, 2)
Send($cropped)
Send("2000")
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

Run("notepad.exe")
Send($objDisplayName)

Thanks for all help, references, ideas, correction.

Thanks everyone.

Link to comment
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')
Else
    MsgBox(0, 'username', $UserObj.FullName)
EndIf
$UserObj = ""
$oMyError = ObjEvent("AutoIt.Error", "")
;COM Error function
Func ComError()
    If IsObj($oMyError) Then
        $HexNumber = Hex($oMyError.number, 8)
        SetError($HexNumber)
    Else
        SetError(1)
    EndIf
    Return 0
EndFunc ;==>ComError
Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...