Sign in to follow this  
Followers 0
effer

Problem closing a window

3 posts in this topic

I have a script, which creates a window with login and password input.

When you click the OK button, the values from the inputs must be saved in variables, and then close the window.

I can't get the button to close the window, when you click it. How do I do that?

The part of the script which creates the windows looks like this:

$loginwindow = GUICreate("Login", 240, 150)

GUICtrlCreateLabel("User'", 30, 30)
$user = GUICtrlCreateInput ( "", 150,  30, 50, 20)
GUICtrlCreateLabel("Pass", 30, 55)
$pass = GUICtrlCreateInput ( "", 150,  55, 70, 20, $ES_PASSWORD)
$ok = GUICtrlCreateButton("OK", 70, 80, 60)

GUICtrlSetOnEvent($ok, "saveinfo")
GUISetState(@SW_SHOW)


Func saveinfo()
    $username = GUICtrlRead($user)
    $password = GUICtrlRead($pass)
    WinClose("Login")
EndFunc

How can i close the window when the button is clicked?

I've tried WinClose("Login"), but nothing happens...

Hope you can help me :P

Share this post


Link to post
Share on other sites



I have a script, which creates a window with login and password input.

When you click the OK button, the values from the inputs must be saved in variables, and then close the window.

I can't get the button to close the window, when you click it. How do I do that?

The part of the script which creates the windows looks like this:

$loginwindow = GUICreate("Login", 240, 150)

GUICtrlCreateLabel("User'", 30, 30)
$user = GUICtrlCreateInput ( "", 150,  30, 50, 20)
GUICtrlCreateLabel("Pass", 30, 55)
$pass = GUICtrlCreateInput ( "", 150,  55, 70, 20, $ES_PASSWORD)
$ok = GUICtrlCreateButton("OK", 70, 80, 60)

GUICtrlSetOnEvent($ok, "saveinfo")
GUISetState(@SW_SHOW)
Func saveinfo()
    $username = GUICtrlRead($user)
    $password = GUICtrlRead($pass)
    WinClose("Login")
EndFunc

How can i close the window when the button is clicked?

I've tried WinClose("Login"), but nothing happens...

Hope you can help me :P

Try using GUIDelete.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Try using GUIDelete.

Nice, works like a charm :P

Havent seen that function in the help files :lmao:

Thanks for the answer

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