raj2734 Posted July 16, 2008 Share Posted July 16, 2008 I'm trying to write a script to open lusrmgr.msc select the Guest account and change it to something else. I'm a noob to AutoIT. So far i've been able to select the account that I want to change (Guest) and now i'm trying to figure out how to rename it to something else. CODE$From = "Guest" $To= "Guest1" Opt("WinTitleMatchMode", 4) Run(@ComSpec & " /c " & 'lusrmgr.msc', "",@SW_HIDE) WinWait("Local Users and Groups","Local Users and Groups (Local)") Sleep(2000) $CLVItem = ControlListView("Local Users and Groups","","SysListView321","FindItem","Users") ControlListView("Local Users and Groups","Local Users and Groups (Local)","SysListView321","Select",$CLVItem) Send("{Tab}{Enter}") ;Probally a better way to do this... $CLVItem = ControlListView("Local Users and Groups","","SysListView321","FindItem",$From) If($CLVItem =-1) Then MsgBox(0,"","Entry " & $From & " not found") Exit EndIf ;MsgBox(0,"","Entry " & $From & " at "& $CLVItem) ControlListView("Local Users and Groups","Local Users and Groups (Local)","SysListView321","Select",$CLVItem) #cs I've now highlighted the account I want to change but I can't seem to find a way to rename the account. I either need to single click it and then wait a second and send the text or right click and go down to rename #ce Any help would be greatly appreciated Link to comment Share on other sites More sharing options...
Zedna Posted July 16, 2008 Share Posted July 16, 2008 Look at "C:\Program Files\AutoIt3\Include\guilistview.au3" standard include file there are many usefull functions. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 16, 2008 Share Posted July 16, 2008 (edited) I'm trying to write a script to open lusrmgr.msc select the Guest account and change it to something else. I'm a noob to AutoIT. So far i've been able to select the account that I want to change (Guest) and now i'm trying to figure out how to rename it to something else. Zedna is right, the _GuiCtrlListView_* functions will help with that, but you would be much better served to drop the GUI entirely and learn to use the WMI COM interface for this. This demo only lists the accounts, but it can do a lot more if you learn how to use that interface: Global Const $wbemFlagReturnImmediately = 0x10 $strComputer = @ComputerName $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount", "WQL", $wbemFlagReturnImmediately) $sMsg = "Local User Accounts: " & $strComputer & @CRLF & "____________________" & @CRLF & @CRLF For $objItem In $colItems $sMsg &= "Name: " & $objItem.Name & @CRLF $sMsg &= "FullName: " & $objItem.FullName & @CRLF $sMsg &= "AccountType: " & $objItem.AccountType & @CRLF $sMsg &= "Description: " & $objItem.Description & @CRLF $sMsg &= "Status: " & $objItem.Status & @CRLF $sMsg &= @CRLF Next ConsoleWrite($sMsg) muttley Edited July 16, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
raj2734 Posted July 17, 2008 Author Share Posted July 17, 2008 Thank you both for your responses. I came up with a work around to get it to work with the Gui. However I agree that doing this without involving the Gui would be much better so i'm taking you up on your advice and looking into learning how to use the WMI COM interface. Initially I was hoping to do it via the command line but couldn't find anyway to do so went the Gui route. Thanks Again. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now