Jump to content

How to enable button when other gui close


Go to solution Solved by fikri1979,

Recommended Posts

Posted

Hello...

i'm beginner programing

how to enable button when other gui close?

my script

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 294, 146, 192, 114)
$START = GUICtrlCreateButton("START", 88, 48, 113, 41)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $START
            run("notepad.exe")
            GUICtrlSetState($START, $GUI_DISABLE)
        Case $START
            ProcessClose("notepad.exe")
            GUICtrlSetState($START, $GUI_ENABLE)
    EndSwitch
WEnd
Posted

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 294, 146, 192, 114)
$START = GUICtrlCreateButton("START", 88, 48, 113, 41)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $START
            run("notepad.exe")
            GUICtrlSetState($START, $GUI_DISABLE)
    EndSwitch
    If Not ProcessExists("notepad.exe") And BitAnd(GUICtrlGetState($START), $GUI_DISABLE) = $GUI_DISABLE Then ; <<<<<<<<<<<< check if process not exist and if botton is disabled
        GUICtrlSetState($START, $GUI_ENABLE)
    EndIf
WEnd

Check the comment part, don't make 2 cases for the same button

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

  • Solution
Posted
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 294, 146, 192, 114)
$START = GUICtrlCreateButton("START", 88, 48, 113, 41)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $START
            run("notepad.exe")
            GUICtrlSetState($START, $GUI_DISABLE)
    EndSwitch
    If Not ProcessExists("notepad.exe") And BitAnd(GUICtrlGetState($START), $GUI_DISABLE) = $GUI_DISABLE Then ; <<<<<<<<<<<< check if process not exist and if botton is disabled
        GUICtrlSetState($START, $GUI_ENABLE)
    EndIf
WEnd

Check the comment part, don't make 2 cases for the same button

thanks you very much...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...