Sign in to follow this  
Followers 0
Jonniemac315

Disable Button After Click

3 posts in this topic

I am looking to Diable the Add and Close button in my script if the Add / Append Data button is pressed can this be done?

#include <GUIConstants.au3>


$Form1 = GUICreate("Add Paths", 491, 204, 266, 125)
GUISetBkColor(0xD4D0C8)
$Input1 = GUICtrlCreateInput("", 16, 16, 457, 21)
$Input2 = GUICtrlCreateInput("", 16, 40, 457, 21)
$Input3 = GUICtrlCreateInput("", 16, 64, 457, 21)
$Input4 = GUICtrlCreateInput("", 16, 88, 457, 21)
$Input5 = GUICtrlCreateInput("", 16, 112, 457, 21)
$Input6 = GUICtrlCreateInput("", 16, 136, 457, 21)
$ADD = GUICtrlCreateButton("Add / Append Data", 295, 168, 150, 25, 0)
$OK = GUICtrlCreateButton("Add and Close", 192, 168, 90, 25, 0)
$Clear = GUICtrlCreateButton("Clear All", 104, 168, 75, 25, 0)
$Exit = GUICtrlCreateButton("Exit", 16, 168, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Exit
            Exit
        Case $Clear
            
        Case $OK
            FileDelete ("c:\Test.txt")
            $file = FileOpen("test.txt", 1)

            If $file = -1 Then
                MsgBox(0, "Error", "Unable to open file.")
                Exit
            EndIf

            $data1 = GUICtrlRead($Input1)
            $data2 = GUICtrlRead($Input2)
            $data3 = GUICtrlRead($Input3)
            $data4 = GUICtrlRead($Input4)
            $data5 = GUICtrlRead($Input5)
            $data6 = GUICtrlRead($Input6)
            FileWrite($file, "" & $data1 & @CRLF)
            FileWrite($file, "" & $data2 & @CRLF)
            FileWrite($file, "" & $data3 & @CRLF)
            FileWrite($file, "" & $data4 & @CRLF)
            FileWrite($file, "" & $data5 & @CRLF)
            FileWrite($file, "" & $data6 & @CRLF)
            FileClose($file)
            Exit
        Case $ADD
            $file = FileOpen("test.txt", 1)

            If $file = -1 Then
                MsgBox(0, "Error", "Unable to open file.")
                Exit
            EndIf

            $data1 = GUICtrlRead($Input1)
            $data2 = GUICtrlRead($Input2)
            $data3 = GUICtrlRead($Input3)
            $data4 = GUICtrlRead($Input4)
            $data5 = GUICtrlRead($Input5)
            $data6 = GUICtrlRead($Input6)
            FileWrite($file, "" & $data1 & @CRLF)
            FileWrite($file, "" & $data2 & @CRLF)
            FileWrite($file, "" & $data3 & @CRLF)
            FileWrite($file, "" & $data4 & @CRLF)
            FileWrite($file, "" & $data5 & @CRLF)
            FileWrite($file, "" & $data6 & @CRLF)
            FileClose($file)
            
            
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites



you mean GUICtrlSetState() ?

:)

Here is the next thing. I want to take this and input the content of the file that I just wrote to a Autoit Script to get file content in that path and put it into an array. I can't figure it out! Please help. Thanks in advance.

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