Jump to content
Sign in to follow this  
fikri1979

How to enable button when other gui close

Recommended Posts

fikri1979

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

Share this post


Link to post
Share on other sites
Terenz

#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

  • Like 1

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

 

Share this post


Link to post
Share on other sites
fikri1979
#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...

Share this post


Link to post
Share on other sites
Terenz

Hope did you understand what is the problem with that script...

  • Like 1

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

 

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  

×