At the moment I'm hung up on trying to figure out how to update the input box with the new prefix when selected by the radio buttons. I think I need to put something in the While loop so it updates that field, but I can't figure out what to put in.
Any hints on what I'd want to do here?
#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <_BatteryQuery.au3> Global $BattStatus, $OldMachine Global $mainwindow, $InUSER, $InPASS, $InOWNER, $BattStatus, $MachineType Global $OutUSER, $OutPASS, $OutOWNER, $OutCompname Global $var = 1 Global $module ;Running a check to see if this is a desktop or laptop $battery = _BatteryQuery() if BitAnd($battery[1],128) Then $BattStatus = 0 ConsoleWrite("No Battery present" & @CRLF) Else $BattStatus = 1 ConsoleWrite("I see a battery" & @CRLF) EndIf ConsoleWrite("BatteryStatus is set to " & $BattStatus & @CRLF) ;These variables are ugly, I'll clean them up later Local $radio1, $radio2, $radio3, $radio4, $radio5, $battery ;Building the GUI $mainwindow = GUICreate("Need Login Credentials", 300, 350) ;Creates a window and assigns it a handle GUICtrlCreateLabel("Enter Information Here...", 30, 10) $okbutton = GUICtrlCreateButton("OK", 115, 300, 60) GUISwitch($mainwindow) GUISetState(@SW_SHOW) GUICtrlCreateLabel("Your Domain Username...", 10, 30, 180) $InUSER = GUICtrlCreateInput("", 10, 45, 275, 20) GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlSetTip(-1, "Used in AD authentication") GUICtrlCreateLabel("Your Password...", 10, 70, 180) $InPASS = GUICtrlCreateInput("", 10, 85, 275, 20, $ES_PASSWORD) GUICtrlSetTip(-1, "Used in AD authentication") GUICtrlCreateLabel("Machine Owner's Username...Leave blank if none", 10, 110, 290) $InOwner = GUICtrlCreateInput("", 10, 125, 275, 20) GUICtrlSetTip(-1, "The user this machine will be assigned to") GUICtrlCreateLabel("NOT FUNCTIONING DO NOT USE Computer Name. Leave blank if no change.", 10, 150, 290) $InCompname = GUICtrlCreateInput("", 10, 165, 275, 20) GUICtrlSetTip(-1, "Renames machine to input specified") GUIStartGroup() GUICtrlCreateLabel("Select Machine Type, Select N/A if not listed",10,190,290) $radio1 = GUICtrlCreateRadio("Desktop", 20, 210, 120) $radio2 = GUICtrlCreateRadio("Laptop", 150, 210, 150) $radio3 = GUICtrlCreateRadio("Kiosk", 20, 230, 120) $radio4 = GUICtrlCreateRadio("PC Services", 150, 230, 150) $radio5 = GUICtrlCreateRadio("N/A", 150, 250, 150) If $BattStatus = 0 Then GUICtrlSetState($radio1, $GUI_CHECKED) $MachineType= 1 Else GUICtrlSetState($radio2, $GUI_CHECKED) $MachineType= 2 EndIf ;While loop for the radio buttons, maybe the labels can be processed in here too somehow? While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ConsoleWrite("Closing script" & @CRLF) Exit Case $msg = $OkButton ConsoleWrite("Moving on to next step" & @CRLF) ConsoleWrite($MachineType & @CRLF) GUISetState(@SW_HIDE) ExitLoop Case GUICtrl Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED ConsoleWrite('You clicked on Desktop.' & @CRLF) $MachineType= 1 Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED ConsoleWrite('You clicked on Laptop.' & @CRLF) $MachineType = 2 Case $msg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED ConsoleWrite('You clicked on Kiosk.' & @CRLF) $MachineType = 3 Case $msg = $radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED ConsoleWrite('You clicked on PC Services.' & @CRLF) $MachineType = 4 Case $msg = $radio5 And BitAND(GUICtrlRead($radio5), $GUI_CHECKED) = $GUI_CHECKED ConsoleWrite('You clicked on N/A.' & @CRLF) $MachineType = 5 EndSelect Sleep(10) WEnd ;Spitting all of the data out to console $OutUSER = GUICtrlRead($InUSER) ConsoleWrite('$OutUSER is set to ' & $OutUSER & @CRLF) $OutPASS = GUICtrlRead($InPASS) ConsoleWrite('$OutPASS is set to ' & $OutPASS & @CRLF) $OutOWNER = GUICtrlRead($InOwner) ConsoleWrite('$OutOWNER is set to ' & $OutOWNER & @CRLF) $OutCompname = GUICtrlRead($InCompname) ConsoleWrite('$InCompname is set to ' & $OutCompname & @CRLF) ConsoleWrite('$MachineType is set to ' & $MachineType & @CRLF)




