IvanCodin Posted June 22, 2008 Share Posted June 22, 2008 How do I detect if the user presses the cancel button in an InputBox? Here is what I am using now: CODEFunc Telnet() $ip = InputBox("IP", "Enter IP to connect to", @IPAddress1) run("telnet " & $ip) If @error Then SplashTextOn("Notice - Error", " Your telnet command failed." & @CRLF & "No telent command avaliable.", 380,55) Sleep(3000) SplashOff() EndIf EndFunc Thanks CC Link to comment Share on other sites More sharing options...
cppman Posted June 22, 2008 Share Posted June 22, 2008 (edited) Return Value Success: Returns the string that was entered. Failure: Returns "" (blank string) and sets @error as follows: @Error 0 = The string returned is valid. 1 = The Cancel button was pushed. 2 = The Timeout time was reached. 3 = The InputBox failed to open. This is usually caused by bad arguments.Just check if @Error equals 1. Func Telnet() $ip = InputBox("IP", "Enter IP to connect to", @IPAddress1) if (@Error == 1) Then MsgBox(0, "", "canceled.") return 0 EndIf run("telnet " & $ip) If @error Then SplashTextOn("Notice - Error", " Your telnet command failed." & @CRLF & "No telent command avaliable.", 380,55) Sleep(3000) SplashOff() EndIf EndFunc Telnet() Edited June 22, 2008 by cppman Miva OS Project 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