Sign in to follow this  
Followers 0
KenzoIT

Have problems with checkbox

5 posts in this topic

Hi all,

My system have 4 servers and I would like to record time when a server have problems at each time. But I don't know how to do it.

I want when I check "Incident" box and choose "Server1". After I click "Record" button --> it will send "Server have a problem" content in D:/Server1/Time_Log.htm

If I check "Troubleshooting" box and click "Record" button --> it will send "SE is troubleshooting an incident" content in D:/Server1/Log_Time.htm

If I check "Resolved" box and click "Record" button --> it will send "Incident is resovled by SE" content in D:/Server1/Log_Time.htm

Server2, server3 and server4 are the same with server1.

Pls instruct me how to do it.

Thanks !

Test.au3

Share this post


Link to post
Share on other sites



I am not sure, did you ask about how to do some action if Checkbox is checked, but if it is, then You could do something like this:

If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then _SomeAction()

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When I check "Incident" box --> it will send "2010-05-20 16:48:58 : Server have a problem." content to D:/Server1/Time_Log.htm but GUICtrlCreateCheckbox function and GUICtrlCreateCombo function doesn't work.

I want GUICtrlCreateCheckbox function, GUICtrlCreateButton function and GUICtrlCreateCombo function work together.

(Server2, server3 and server4 are the same with server1)

Anyone help me to complete this case ?

Test.au3

Edited by KenzoIT

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Something like this:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <Word.au3>
#Include <GuiButton.au3>
#include <IE.au3>


AutoItSetOption("GUICloseOnESC", 0)

$Form = GUICreate("Record Time", 400, 310,-1,-1)
Local $oIE = _IECreateEmbedded()

Global $iMemo = GUICtrlCreateObj($oIE, 10, 110, 380,180, 0)
GUICtrlSetFont(-1, 11.5, 600)

$Checkbox1 = GUICtrlCreateCheckbox("Incident", 10, 10)
GUICtrlSetTip(-1,"Server have a problem")

$Checkbox2 = GUICtrlCreateCheckbox("Troubleshooting", 90, 10)
GUICtrlSetTip(-1,"SE is troubleshooting an incident")

$Checkbox3 = GUICtrlCreateCheckbox("Resolved", 200, 10)
GUICtrlSetTip(-1,"Incident is resovled by SE")

$record = GUICtrlCreateButton("Record",10,60,80,40)

GUICtrlSetFont(-1, 11.5, 600)

$server = GUICtrlCreateCombo("Server1",330,5,60,20)
GUICtrlSetData($server,"Server2|Server3|Server4")

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $record
            If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
                MsgBox(0, "Test", "Incident Checked" & @CRLF & "Server: " & GUICtrlRead($server))
                _filewritelog(@ScriptDir & "/test.htm", "Incident" & "<p>")
                _IENavigate($oIE, @ScriptDir & "/test.htm")
            EndIf
            If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
                MsgBox(0, "Test", "Troubleshooting Checked" & @CRLF & "Server: " & GUICtrlRead($server))
                _filewritelog(@ScriptDir & "/test.htm", "Troubleshooting" & "<p>")
                _IENavigate($oIE, @ScriptDir & "/test.htm")
            EndIf
            If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then
                MsgBox(0, "Test", "Resolved Checked" & @CRLF & "Server: " & GUICtrlRead($server))
                _filewritelog(@ScriptDir & "/test.htm", "Resolved" & "<p>")
                _IENavigate($oIE, @ScriptDir & "/test.htm")
            EndIf
        ;Case $record
        ;   _filewritelog("D:/Server1/Log_Time.htm", GUICtrlRead ($Checkbox1))
        ;   _IENavigate($oIE, "file:///D:/Server1/Log_Time.htm")

        ;Case $record
        ;   _filewritelog("D:/Server2/Log_Time.htm", GUICtrlRead ($Checkbox2))
        ;   _IENavigate($oIE, "file:///D:/Server2/Log_Time.htm")
    EndSwitch
WEnd
Edited by Makaule

Share this post


Link to post
Share on other sites

Got it to work now, thanks for the quick answer. :idea:

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