IvanCodin 0 Posted January 24, 2011 (edited) I cant seem to get the timeout to work. I want the user to be presented with a default value that can be changed or it will send the default value entered in the inputbox after the timeout. The Help shows some of the values as -1, what does this do? Tried several variations of this. $Server = InputBox("Server", "Enter you server name:", "192.168.1.1", " M", 220, 180, -1, -1, 5) The help says: InputBox ( "title", "prompt" [, "default" [, "password char" [, width [, height [, left [, top [, timeout [, hwnd]]]]]]]] ) $Server = InputBox("Server", "Enter you server name:", "192.168.1.1", " M", 220, 180, , , 5) <= This errors wrong syntax $Server = InputBox("Server", "Enter you server name:", "192.168.1.1", " M", 220, 180, 0, 0, 5) < This errors also I want it to timeout after 5 seconds and set $server value to the 192.168.1.1 default ip address. Thanks Me Edited January 24, 2011 by IvanCodin Share this post Link to post Share on other sites
jaberwacky 327 Posted January 24, 2011 $Server = InputBox("Server", "Enter you server name:", "192.168.1.1", " M", 220, 180, 0, 0, 5) < This errors alsoThis works fine for me.Win7 x64 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Share this post Link to post Share on other sites
Varian 8 Posted January 24, 2011 You were correct with your first line. What you have to remember is that if the timeout is reached, $Server will be 0 since it was not assigned. If you use an InputBox(), remember to Exit or Return or ContinueLoop after that directly after that line If @error = 1 Then Exit Note that if the user inputs conforming text and presses OK, the @error value remains at 0, but if the timeout is reached, the @error is 2$Default_Server = "192.168.1.1" $Server = InputBox("Server", "Enter you server name:", $Default_Server, " M", 220, 180, -1, -1, 5) Switch @error Case 0 $Error = @error $Msg = "You pressed OK with a Valid String" & @LF & 'Server is...' & $Server Case 2 $Server = $Default_Server ;You must define $Server manually since timeout was reached $Error = @error $Msg = "The Timeout time was reached." & @LF & 'Server assigned to default...' & $Server Case Else Exit EndSwitch MsgBox(262208, $Error, $Msg) Share this post Link to post Share on other sites