Sign in to follow this  
Followers 0
Joseph

gui close button not working

6 posts in this topic

i made a auto it that presses the right arrow every 15 seconds, but i'm trying to make the gui so that u can click exit and the program shuts down, for now the close at the top right doesn't work either, only the minimize, and the loop i used for the right arrow is supposed to go until the exit message box opens. i know theres a better way i just don't know how to do it

#include <GuiConstants.au3>
GUICreate("Right Arrow App", 300, 100,)
$ExitId = GUICtrlCreateButton("Exit",20,20,20,20)
GUISetState() 


Do
 $msg = GUIGetMsg()
 Select
  Case $msg= $ExitId
  MsgBox(0,"Closing Down Arrow App", "Exit")    
  Case $msg= $GUI_EVENT_CLOSE
  MsgBox(0,"Closing Down Arrow App", "Closing")
 EndSelect
Sleep(15000)
Send("{right}")


Until $msg = $GUI_EVENT_CLOSE or $msg = $ExitId

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <GuiConstants.au3>
GUICreate("Right Arrow App", 300, 100,)
$ExitId = GUICtrlCreateButton("Exit", 20, 20, 20, 20)
GUISetState()


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $ExitId
            MsgBox(0, "Closing Down Arrow App", "Exit")
            Sleep(15000)
            Send("{RIGHT}")
            ExitLoop
        Case - 3 ;GUI_EVENT_CLOSE
            MsgBox(0, "Closing Down Arrow App", "Closing")
            Sleep(15000)
            Send("{RIGHT}")
            ExitLoop
    EndSwitch
WEnd

Edited by Alienware

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
GUICreate("Right Arrow App", 300, 100,)
$ExitId = GUICtrlCreateButton("Exit", 20, 20, 20, 20)
GUISetState()


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $ExitId
            MsgBox(0, "Closing Down Arrow App", "Exit")
            Sleep(15000)
            Send("{RIGHT}")
            ExitLoop
        Case - 3 ;GUI_EVENT_CLOSE
            MsgBox(0, "Closing Down Arrow App", "Closing")
            Sleep(15000)
            Send("{RIGHT}")
            ExitLoop
    EndSwitch
WEnd

ok i worked with what u edited but i had to change it to this which does the right arrow every 5 seconds (15 sec or 5 doesn't matter yet) .. because your code waited 15 seconds before closing the program

#include <GuiConstants.au3>
GUICreate("Right Arrow App", 300, 100)
$ExitId = GUICtrlCreateButton("Exit", 20, 20, 20, 20)
GUISetState()


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $ExitId
            MsgBox(0, "Closing Down Arrow App", "Exit")
            ExitLoop
        Case - 3;GUI_EVENT_CLOSE
            MsgBox(0, "Closing Down Arrow App", "Closing")
            ExitLoop
        EndSwitch
Sleep(5000)
Send("{RIGHT}")
WEnd

Share this post


Link to post
Share on other sites

can u give me an example of how to work with AdlibEnable

The helpfile has a great assortment of examples, including one with AdlibEnable and AbLibDisable!

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