Sign in to follow this  
Followers 0
Tukata

InputBox question

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  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

Share this post


Link to post
Share on other sites

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

:)

Share this post


Link to post
Share on other sites

Many many thanks.

That was what I needed.

Tuk

Share this post


Link to post
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
Sign in to follow this  
Followers 0