colesam Posted August 16, 2016 Share Posted August 16, 2016 expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> openGUI() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bTroubleshoot ShellExecute('http://www.stthomas.edu/its/facultystaff/wifi/') Case $bSave getData() Global $saveLocation = FileSaveDialog('Save file', @ScriptDir, 'Text files (*.txt)', 16);get save location writeGeneral() writeNetwork() writeAccounts() writePrograms() resetFields() Case $bReset resetFields() EndSwitch WEnd Func openGUI() #Region ### START Koda GUI section ### Form= Global $Form1_1_1_1 = GUICreate("Form1", 820, 455, 190, 115) Global $tabs = GUICtrlCreateTab(0, 0, 817, 433) Global $tGeneral = GUICtrlCreateTabItem("General") Global $iUsername = GUICtrlCreateInput("", 16, 68, 121, 22, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $iPhone = GUICtrlCreateInput("", 16, 132, 121, 22, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $iLocation = GUICtrlCreateInput("", 16, 196, 121, 22, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $iAsset = GUICtrlCreateInput("", 16, 260, 121, 22, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $iOS = GUICtrlCreateInput("", 16, 324, 121, 22, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $lUsername = GUICtrlCreateLabel("Username:", 16, 44, 55, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $lPhone = GUICtrlCreateLabel("Phone Number:", 16, 108, 78, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $lLocation = GUICtrlCreateLabel("Location:", 16, 172, 48, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $lAsset = GUICtrlCreateLabel("Asset Number:", 16, 236, 73, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $lOS = GUICtrlCreateLabel("Operating System", 16, 300, 87, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $lTime = GUICtrlCreateLabel("Problem Started:", 16, 364, 114, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $iTime = GUICtrlCreateInput("", 16, 388, 121, 22, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $gComputer = GUICtrlCreateGroup("Computer", 248, 44, 137, 89) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $cbPC = GUICtrlCreateCheckbox("PC", 264, 68, 33, 17) Global $cbMac = GUICtrlCreateCheckbox("Mac", 264, 100, 41, 17) Global $cbDesktop = GUICtrlCreateCheckbox("Desktop", 312, 68, 65, 17) Global $cbLaptop = GUICtrlCreateCheckbox("Laptop", 312, 100, 57, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $boxAddInfo = GUICtrlCreateEdit("", 248, 180, 537, 217, BitOR($GUI_SS_DEFAULT_EDIT,$WS_BORDER)) GUICtrlSetData(-1, "") GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $lAdditional = GUICtrlCreateLabel("Additional Information:", 248, 156, 105, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $bSave = GUICtrlCreateButton("Save", 516, 49, 107, 49) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $bReset = GUICtrlCreateButton("Reset", 644, 49, 107, 49) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $tNetwork = GUICtrlCreateTabItem("Other") Global $gNetwork = GUICtrlCreateGroup("Network", 16, 44, 337, 281) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $gConnectionType = GUICtrlCreateGroup("Connection Type", 28, 77, 153, 89) Global $rWiFi = GUICtrlCreateRadio("WiFi Connection", 40, 104, 113, 17) Global $rTether = GUICtrlCreateRadio("Tethered Connection", 40, 128, 121, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $gUstRegOpen = GUICtrlCreateGroup("UST or UST-Open", 28, 173, 153, 89) Global $rUstReg = GUICtrlCreateRadio("UST", 40, 200, 57, 17) Global $rUstOpen = GUICtrlCreateRadio("UST - Open", 40, 224, 81, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $lIP = GUICtrlCreateLabel("IP Address:", 201, 77, 60, 18) Global $iIP = GUICtrlCreateInput("", 197, 100, 137, 22) Global $lDNS = GUICtrlCreateLabel("DNS Servers:", 201, 135, 70, 18) Global $boxDNS = GUICtrlCreateEdit("", 197, 158, 137, 101, BitOR($ES_WANTRETURN,$WS_BORDER)) GUICtrlSetData(-1, "") Global $bTroubleshoot = GUICtrlCreateButton("Troubleshoot Guide", 28, 268, 153, 41) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $gAccountsEmails = GUICtrlCreateGroup("Accounts / Emails", 368, 44, 433, 137) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $gUSTRole = GUICtrlCreateGroup("University Role", 376, 66, 121, 105) Global $rActiveStud = GUICtrlCreateRadio("Active Student", 384, 90, 97, 17) Global $rFacStaff = GUICtrlCreateRadio("Faculty / Staff", 384, 114, 97, 17) Global $rAlumnus = GUICtrlCreateRadio("Alumnus", 384, 138, 65, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $cbAccClaim = GUICtrlCreateCheckbox("Account Claimed", 504, 66, 97, 17) Global $cbOtherBrowsers = GUICtrlCreateCheckbox("Does Not Work In Other Browsers", 608, 66, 185, 17) Global $boxErrorsA = GUICtrlCreateEdit("", 504, 90, 289, 80, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL,$WS_BORDER)) GUICtrlSetData(-1, "Enter Error Messages Here") GUICtrlCreateGroup("", -99, -99, 1, 1) Global $gPrograms = GUICtrlCreateGroup("Programs", 368, 188, 433, 137) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $lVersion = GUICtrlCreateLabel("Version:", 384, 218, 45, 18) Global $iVersion = GUICtrlCreateInput("", 376, 241, 137, 22) Global $boxErrorsP = GUICtrlCreateEdit("", 528, 210, 265, 105, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL,$WS_BORDER)) GUICtrlSetData(-1, "Enter Error Messages Here") Global $cbRestart = GUICtrlCreateCheckbox("Restarted Computer", 384, 282, 121, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc Func getData() Global $username = GUICtrlRead($iUsername);general tab Global $phone = GUICtrlRead($iPhone) Global $location = GUICtrlRead($iLocation) Global $asset = GUICtrlRead($iAsset) Global $OS = GUICtrlRead($iOS) Global $time = GUICtrlRead($iTime) Global $addInfo = GUICtrlRead($boxAddInfo) Global $isPC = GUICtrlRead($cbPC) Global $isMac = GUICtrlRead($cbMac) Global $isDesktop = GUICtrlRead($cbDesktop) Global $isLaptop = GUICtrlRead($cbLaptop) Global $isWifi = GUICtrlRead($rWiFi);network tab Global $isTethered = GUICtrlRead($rTether) Global $isUST = GUICtrlRead($rUstReg) Global $isUSTOpen = GUICtrlRead($rUstOpen) Global $ipAddress = GUICtrlRead($iIP) Global $serversDNS = GUICtrlRead($boxDNS) Global $isActiveStud = GUICtrlRead($rActiveStud);accounts/email tab Global $isFacStaff = GUICtrlRead($rFacStaff) Global $isAlumnus = GUICtrlRead($rAlumnus) Global $isClaimed = GUICtrlRead($cbAccClaim) Global $isNotOtherBrowser = GUICtrlRead($cbOtherBrowsers) Global $errorMessagesA = GUICtrlRead($boxErrorsA) Global $version = GUICtrlRead($iVersion);programs tab Global $isRestart = GUICtrlRead($cbRestart) Global $errorMessagesP = GUICtrlRead($boxErrorsP) EndFunc Func writeData($prompt, $content) FileWrite($saveLocation, @CRLF & $prompt & $content) EndFunc Func writeLine($prompt, $content) FileWrite($saveLocation, $prompt & $content) EndFunc Func writeGeneral() If (StringLen($username) > 0) Then writeData('Username: ', $username) EndIf If (StringLen($phone) > 0) Then writeData('Phone Number: ', $phone) EndIf If (StringLen($location) > 0) Then writeData('Location: ', $location) EndIf If (StringLen($asset) > 0) Then writeData('Asset Number: ', $asset) EndIf If (StringLen($OS) > 0) Then writeData('Operating System: ', $OS) EndIf If (StringLen($time) > 0) Then writeData('Problem Started: ', $time) EndIf If ($isDesktop = 1) Then writeData('Computer Info: ', 'Desktop') EndIf If ($isLaptop = 1) Then writeData('Computer Info: ', 'Laptop') EndIf If ($isPC = 1) Then writeLine(' / ', 'PC') EndIf If ($isMac = 1) Then writeLine(' / ', 'Mac') EndIf If (StringLen($addInfo) > 0) Then writeData('Additional Information: ' & @CRLF, $addInfo) EndIf EndFunc Func writeNetwork() writeData(@CRLF, @CRLF) If ($isWifi = 1) Then writeData('Connection Type: ', 'WiFi') EndIf If ($isTethered = 1) Then writeData('Connection Type: ', 'Tethered') EndIf If ($isUST = 1) Then writeLine(' / ', 'UST') EndIf If ($isUSTOpen = 1) Then writeLine(' / ', 'UST-Open') EndIf If (StringLen($iIP) > 0) Then writeData('IP Address: ', $iIP) EndIf If (StringLen($boxDNS) > 0) Then writeData('DNS Servers: ', @CRLF & $boxDNS) EndIf EndFunc Func writeAccounts() writeData(@CRLF, @CRLF) If ($isClaimed = 1) Then writeData('Account Claimed: ', '[CLAIMED]') Else writeData('Account Claimed: ', '[UNCLAIMED]') EndIf If ($isNotOtherBrowser = 1) Then writeData('Program works in other browsers', '') Else writeData('Program does not work in any browsers', '') EndIf If (StringLen($boxErrorsA) > 0) Then writeData('Error Messages:', @CRLF & $boxErrorsA) EndIf EndFunc Func writePrograms() writeData(@CRLF, @CRLF) If (StringLen($iVersion) > 0) Then writeData('Version:', $iVersion) EndIf If ($isRestart = 1) Then writeData('Restart: Restarting computer solved the problem', '') Else writeData('Restart: Restarting the computer did not solve the problem', '') EndIf EndFunc Func resetFields() GUIDelete() openGUI() EndFunc I apologize in advance if I'm breaking some coding rules or if my code is difficult to read. This is my first time coding in a scripting language and I'm not too familiar with the conventions. My issue is with lines 91 and 93, and then lines 139 and 140, and then lines 227 to 233. What is happening is I'm trying to have the user enter an ip address and DNS server address and have the script write it to a notepad file. However somewhere along the code it writes 38 for IP address and 40 for DNS server no matter what's in the box (empty or otherwise). Link to comment Share on other sites More sharing options...
Developers Jos Posted August 16, 2016 Developers Share Posted August 16, 2016 You are writing the control handle in stead of the variable: use $serversDNS in stead of $boxDNS when writing to the file. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
colesam Posted August 16, 2016 Author Share Posted August 16, 2016 Ah thank you! I did not see that. 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