Search the Community
Showing results for tags 'questions'.
Found 1 result
Taking the idea from @Melba23's (btw, thanks ) ExtMsgBox and also making use of his StringSize UDF, I made a extended version of the InputBox function. From the README file: This UDF creates input boxes (just like native InputBox), but with multiple inputs. You can also set some inputs to be password-style, set the default texts for some of the edits and even set the label of the OK/cancel buttons. How to use _ExtInputBox($sTitle, $sTexts [ , $sDefaults = Null [ , $sPasswords = Null [ , $sBtnLabels = "OK|Cancel" [ , $iWidth = -1 [ , $iLeft = -1 [ , $iTop = -1 [ , $iTimeout = 0 [ , $hParent = 0 ] ] ] ] ] ] ] ] ) Arguments are: $sTitle (mandatory): The window title (e.g.: "Hello World") $sTexts (mandatory): The edit labels, separated by | (e.g.: "Your email|Your password") $sDefaults: The default input texts, separated by | (e.g.: "|firstname.lastname@example.org||" will tell that the first input will have nothing as default text, the second will have email@example.com as default text and the third and forth will also have nothing). Note that if you set the default value of 1 input, you must set the value of them all (even if it's nothing), otherwise all inputs will have no default value. Default is none. $sPasswords: One or more 1-based index of inputs, separated by anything that is not a number (pipeline - | - recommended), of the inputs that will receive password style (e.g.: "2|3" wíll tell that the second and third inputs are password-style, default is none) $sBtnLabels: The TWO label of the default OK/Cancel buttons (e.g.: "Submit|Close") $iWidth: Window width (default is the size of the longest string with the limit of 25% of the screen width). Obviously it's not possible to set the height as it's calculated automatically. $iLeft: Distance of the window from the left side of the screen (default is centered) $iTop: Distance of the window to the top of the screen (default is centered) $iTimeout: Time limit for filling the form data (default is none) $hParent: Parent form (default is none) Return value Sucess: an 1-based array with the input values entered ($aArray = 1st input value, $aArray = 2nd input value, $aArray[n] = nth input value, whereas $aArray = input count) Failure: False, and set @extended to 1 if the user clicked cancel, 2 if the user closed the window, or 3 if timeout ended. Examples (two of them) #include 'ExtInputBox.au3' $sData = _ExtInputBox("Login", "Username|Password", Null, "2") If $sData = False Then MsgBox(0, "", "You pressed cancel, exit or timeout ended.") Else MsgBox(0, "You entered:", "Username: " & $sData & @CRLF & "Password: " & $sData) EndIf #include 'ExtInputBox.au3' $sData = _ExtInputBox("Login", "Your full name|Your email|Your telephone|Choose an username|Choose a password|Repeat password", "Mr./Ms. ||+1 |admin||", "5,6", "Register|Cancel") If $sData = False Then Switch @extended Case 1 MsgBox(0, "", "You clicked Cancel") Case 2 MsgBox(0, "", "You closed the window.") Case 3 MsgBox(0, "", "Timeout ended (but we have no timeout on this example, so this will never happen)") EndSwitch Else MsgBox(0, "You entered:", "Full name: " & $sData & @CRLF & _ "Email: " & $sData & @CRLF & _ "Telephone:" & $sData & @CRLF & _ "Username: " & $sData & @CRLF & _ "Password: " & $sData & @CRLF & _ "Password repeat: " & $sData) EndIf Download Download ZIP from GitHub Btw, fork me on Github