Jump to content

InputBox functionality sanity check


Recommended Posts

Re: InputBox function...

Am I "up in the night", or should not the value in the "Default" field be passed if the timeout threshold is reached? Specifically, the following line returns a NULL if nothing is entered in fifteen seconds, but I would have thought that it should return the value. It shows properly and is passed if you hit enter, but I am looking for an unattended script with default values. Note: I have a work-around, but it is ugly and I am just performing a self-sanity-check. Thanks!

$sTID1 = InputBox("Transaction Manager Installation - step 1/3", "What is your destination server IP?", "10.231.201.160","",355,120,Default,Default,15)

Link to comment
Share on other sites

The timeout function basically performs a cancel on the InputBox. You can verify this by checking @error. See below. I would say make the default value a variable and assign it if the return is "" and @Error = 2

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.

$defaultip = "10.231.201.160"
$sTID1 = InputBox("Transaction Manager Installation - step 1/3", "What is your destination server IP?", $defaultip,"",355,120,Default,Default,15)
If $sTID1 = "" and @error = 2 Then
    SetError(0)
    $sTID1 = $defaultip
EndIf
Edited by spudw2k
Link to comment
Share on other sites

I know you said you have a workaround, but as you are looking for "an unattended script with default values", you could simply do this;

$Def_IP = "10.231.201.160"
$sTID1 = InputBox("Transaction Manager Installation - step 1/3", "What is your destination server IP?", $Def_IP,"",355,120,Default,Default,15)
If $sTID1 = "" Then $sTID1 = $Def_IP
MsgBox(0, "$sTID1", $sTID1)

The better way to approach this (if this is unacceptable) is to use a GUI.

EDIT Doh got beat...

Edited by someone
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...