Jump to content

Recommended Posts

Posted

I have this script and want to close the inputbox if "Cancel" is pressed.

How do I do that ?

$answer = InputBox("Test", "Enter a word", "Planet Earth", "", 200, 100)
MsgBox(4096, "Test", $answer)

While 1
    Sleep(100)
WEnd

Thank you

Posted (edited)

Add this below the InputBox line:

If @error then exit

-edit-

And if that's all the code you have, no need for the loop. That'll only make it stay there for ever.

Edited by Nahuel
Posted

I have this script and want to close the inputbox if "Cancel" is pressed.

How do I do that ?

$answer = InputBox("Test", "Enter a word", "Planet Earth", "", 200, 100)
MsgBox(4096, "Test", $answer)

While 1
    Sleep(100)
WEnd

Thank you

If you want you can put that in a loop and exit when user cancels.

While 1

$answer = InputBox("Test", "Enter a word", "Planet Earth", "", 200, 100)
If @error then exit
MsgBox(4096, "Test", $answer)

WEnd

:)

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
×
×
  • Create New...