Sign in to follow this  
Followers 0
fcjoe

Full name instead of username

4 posts in this topic

Hello,

AutoIt has a built in macro for username (@Username). But how do you get the full name (First and Last name) of the current logged on user? Is there a way to do this?

Thanks,

Joe

Share this post


Link to post
Share on other sites



Try this courtesy of weaponx

MsgBox(0,"User Full Name",GetFullName(@UserName))

Func GetFullName($sUserName)
    $colItems = ""
    $strComputer = "localhost"

    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Name = '" & $sUserName &  "'", "WQL", 0x10 + 0x20)

    If IsObj($colItems) then
       For $objItem In $colItems
          Return $objItem.FullName
       Next
    Else
       Return SetError(1,0,"")
    Endif
EndFunc

Original post http://www.autoitscript.com/forum/index.ph...ic=79129&hl


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Try this courtesy of weaponx

MsgBox(0,"User Full Name",GetFullName(@UserName))

Func GetFullName($sUserName)
    $colItems = ""
    $strComputer = "localhost"

    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Name = '" & $sUserName &  "'", "WQL", 0x10 + 0x20)

    If IsObj($colItems) then
       For $objItem In $colItems
          Return $objItem.FullName
       Next
    Else
       Return SetError(1,0,"")
    Endif
EndFunc

Original post http://www.autoitscript.com/forum/index.ph...ic=79129&hl

Perfect, Thanks

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