Jump to content

gui close button not working


Joseph
 Share

Recommended Posts

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
Link to comment
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

Edited by Alienware
Link to comment
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
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...