stev379 Posted February 9, 2005 Share Posted February 9, 2005 How can an inputbox be created such that it contains more than one field? Basically, I want to enter the admin password, a local user name and a new password for that local user. The script below works well, but there's a new window for each inputbox. I'd like to have all 3 fields in one box. Dim $AdmPW, $UsrPW, $UsrNM $AdmPW = InputBox("Admin Password", "Enter Administrator password.", "", "*") $UsrNM = InputBox("User Name", "Enter user name.", "", "") $UsrPW = InputBox("Set User Password", "Enter a password to set for local user " & $UsrNM, "", "*") RunAsSet("Administrator", @Computername, $AdmPW) Run("net user " & $UsrNM & $UsrPW) Link to comment Share on other sites More sharing options...
stev379 Posted February 9, 2005 Author Share Posted February 9, 2005 Correction on that last line above. A space " " is needed between the username and the userpassword Run("net user " & $UsrNM & " " & $UsrPW) Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted February 9, 2005 Share Posted February 9, 2005 Make a GUI. Look up GUI in the AUI help file Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
stev379 Posted February 9, 2005 Author Share Posted February 9, 2005 I'm trying to, but haven't used AutoIT for about a year, and didn't use it that much even then. I'm just working through trying to get familiar with it but not having much success. Though I've tried many many things:), not able to get the gui to do what I want. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted February 9, 2005 Share Posted February 9, 2005 Hehe, that makes two of us, I still have to get down and dirty with the gui functions... Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
CyberSlug Posted February 9, 2005 Share Posted February 9, 2005 expandcollapse popup; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> GuiCreate("Example AutoIt Script", 392, 263,(@DesktopWidth-392)/2, (@DesktopHeight-263)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Label_1 = GuiCtrlCreateLabel("Admin Password: ", 10, 30, 110, 20, $SS_RIGHT) $Label_2 = GuiCtrlCreateLabel("User's name: ", 10, 80, 110, 20, $SS_RIGHT) $Label_3 = GuiCtrlCreateLabel("New user password: ", 10, 130, 110, 20, $SS_RIGHT) $Input_AdmPW = GuiCtrlCreateInput("", 130, 30, 230, 20, $ES_PASSWORD) GuiCtrlSetState($Input_AdmPW, $GUI_FOCUS) ;start with cursor in this textbox $Input_UsrNM = GuiCtrlCreateInput("", 130, 80, 230, 20) $Input_UsrPW = GuiCtrlCreateInput("", 130, 130, 230, 20, $ES_PASSWORD) $Button_OK = GuiCtrlCreateButton("OK", 30, 200, 120, 40) GuiCtrlSetState($Button_OK, $GUI_DEFBUTTON) $Button_Cancel = GuiCtrlCreateButton("&Cancel", 240, 200, 120, 40) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_Cancel ExitLoop Case $msg = $Button_OK $AdmPW = GuiCtrlRead($Input_ADmPW) $UsrNM = GuiCtrlRead($Input_UsrNM) $UsrPW = GUICtrlRead($Input_UsrPW) Opt("RunErrorsFatal", 0);don't crash script RunAsSet("Administrator", @Computername, $AdmPW) $success = Run("net user " & $UsrNM & $UsrPW) If $success Then MsgBox(4096,"Done","Password reset for " & $UserNM) GuiCtrlSetData($Input_AdmPW, "") GuiCtrlSetState($Input_UsrNM, $GUI_FOCUS) ;start with cursor in this textbox GuiCtrlSetData($Input_UsrPW, "") Else MsgBox(4096,"Error", "Error resetting password...") GuiCtrlSetState($Input_UsrNM, $GUI_FOCUS) ;start with cursor in this textbox EndIf RunAsSet();reset AutoIt's Run credentials EndSelect WEnd Exit Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! 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