Jump to content

GUI Code Line Clean Up Help


Recommended Posts

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

okay chovie, at this point i can only clean up your code since you are the only one (i hope at least) who knows what the code should do. i cannot make educated guesses, and you cannot expect that i can read your mind. sorry.

.

#Region
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=System Checker
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=CH0VI3
#AutoIt3Wrapper_Add_Constants=n
#EndRegion

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#include <GuiTab.au3>
#include <IE.au3>
;==============================================================================
#Region ### START Koda GUI section ### Form=E:\koda_1.7.3.0.1\Forms\CCTV.kxf
;=================== VAR ======================================================
Global $ilasttab,$SetButton[8],$UnitsCombo[8],$OK1Button[8],$RaidButton[8],$RemoteCombo[8],$OK2Button[8],$IPAddress[3],$PingButton[3], $file, $config, $SVR_selection
;=================== GUI ======================================================
$cctv = GUICreate("SERVERS", 580, 345, 193, 128)
$lab1 = GUICtrlCreateLabel("", 510, 300, 55, 30)
;===============================================
$htab = GUICtrlCreateTab(10, 10, 560, 325)
;-------------------------------------------
GUICtrlCreateTabItem("SERVERS")
For $i=0 To 7
    $SetButton[$i]=GUICtrlCreateButton("SET "&$i+1, 14+70*$i, 45, 60, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlSetBkColor(-1, 6075391)
    ;-------------------------------------------
    $UnitsCombo[$i]=GUICtrlCreateCombo("UNITS", 14+70*$i, 85, 60, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    For $j=1 To 15+10*($i<3)+25*($i<2)
        GUICtrlSetData(-1,"SVR "&$j)
    Next
    $OK1Button[$i] = GUICtrlCreateButton("OK", 14+70*$i, 110, 60, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlSetBkColor(-1, 65280)
Next
;=========================================================
GUICtrlCreateTabItem("STORAGE")
For $i=0 To 7
    $RaidButton[$i] = GUICtrlCreateButton("SAN "&$i+1, 14+70*$i, 45, 60, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlSetBkColor(-1, 16776960)
Next
;=========================================================
GUICtrlCreateTabItem("REMOTE")
For $i=0 To 7
    $RemoteCombo[$i]=GUICtrlCreateCombo("Remote", 14+70*$i, 85, 60, 25)
    GUICtrlSetFont(-1, 7, 400, 0, "Arial")
    For $j=1 To 15+10*($i<3)+25*($i<2)
        GUICtrlSetData(-1,"SVR "&$j)
    Next
    $OK2Button[$i] = GUICtrlCreateButton("OK", 14+70*$i, 110, 60, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlSetBkColor(-1, 65280)
Next
;=========================================================
GUICtrlCreateTabItem("EXTRAS")

$config = GUICtrlCreateButton("V5.0", 14, 90, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
$config1 = GUICtrlCreateButton("V5.3", 79, 90, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
$config2 = GUICtrlCreateButton("V6.0", 144, 90, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
$config3 = GUICtrlCreateButton("V6.1", 209, 90, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
$macadd = GUICtrlCreateButton("TELNET", 14, 50, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
$note = GUICtrlCreateButton("NOTEPAD", 79, 50, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
For $i=0 To 2
    $ipaddress[$i] = _GUICtrlIpAddress_Create($cctv, 14, 295-40*$i, 130, 25)
    _GUICtrlIpAddress_Set($ipaddress[$i], "0.0.0.0")
    _GUICtrlIpAddress_ShowHide($ipaddress[$i], @SW_HIDE)
    $PingButton[$i] = GUICtrlCreateButton("GO", 145, 295-40*$i, 40, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    If $i<>1 Then GUICtrlSetBkColor(-1, 2842846)
Next
;-------------------------------------------
$pingjnb = GUICtrlCreateButton("SVR PING", 14, 120, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
$lab2 = GUICtrlCreateLabel("Telnet Cameras", 14, 240, 80, 15)
$lab3 = GUICtrlCreateLabel("Ping Cameras", 14, 280, 80, 15)
$lab4 = GUICtrlCreateLabel("IEXPL Cameras", 14, 200, 80, 15)
$lab5 = GUICtrlCreateLabel("Configurators", 14, 76, 80, 15)
;-------------------------------------------
#EndRegion
_Tick()

AdlibRegister("_Tick",1000)

GUISetState()

Do
    $nmsg = GUIGetMsg()
    For $i=0 To 7
        If $nmsg=$SetButton[$i] Then _SetButtons($i)
        If $nmsg=$OK1Button[$i] Then _OK1Buttons($i)
    Next
    For $i=0 To 2
        If $nmsg=$PingButton[$i] Then _PingButtons($i)
    Next

;       If $nmsg=$RaidButton[$i] Then ; function

    $icurrtab = _GUICtrlTab_GetCurFocus($htab)
    If $icurrtab <> $ilasttab Then
        $ilasttab = $icurrtab
        For $i=0 To 2
            If $icurrtab=3 Then
                _GUICtrlIpAddress_ShowHide($IPAddress[$i], @SW_SHOW)
            Else
                _GUICtrlIpAddress_ShowHide($IPAddress[$i], @SW_HIDE)
            EndIf
        Next
    EndIf
Until $nmsg=$gui_event_close

Func _OK1Buttons($i)
    Local $SVR_selection = GUICtrlRead($UnitsCombo[$i])
    If $SVR_selection = "SVR" & $i Then
        Local $sfilespec = "Filename"
        Local $file = FileOpen($sfilespec, 0)
        If $file = -1 Then
            MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'")
            Exit
        EndIf
        _Command($file)
    EndIf
EndFunc

Func _SetButtons($i)
    Local $sfilespec = "Filename"
    Local $file = FileOpen($sfilespec, 0)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'")
        Return
    EndIf
    _Command($file)
EndFunc

Func _Command($file)
    While 1
        Local $sline = FileReadLine($file)
        If @error = -1 Then Return
        Local $swindowtitle = "Telnet " & $sline
        Local $result = Run(@ComSpec & " /c telnet " & $sline)
        If $result <> 0 Then
            Sleep(500)
            WinActivate($swindowtitle)
            Sleep(400)
            Send("Key")
            Sleep(300)
            Send("Key")
            Sleep(400)
            Send("Key")
            Sleep(300)
            Send("Key")
            Sleep(300)
        Else
            MsgBox(0, "Error", "Failed to run Telnet for server '" & $sline & "'!")
        EndIf
    WEnd
EndFunc

Func _PingButtons($i)
    Local $s_ip = _GUICtrlIpAddress_Get($ipaddress[$i])
    If $i=0 Then
        If Ping($s_ip) > 0 Then
            MsgBox(0, "Ping Test", "Reply")
        Else
            MsgBox(0, "Ping Test", "No Reply")
        EndIf
    ElseIf $i=1 Then
        If Ping($s_ip) > 0 Then
            Run(@ComSpec & " /c telnet ")
            ;If $s_ip <> 0 Then
            ;EndIf
            Sleep(500)
            Send("o")
            Sleep(500)
            Send("{SPACE}")
            Sleep(500)
            Send($s_ip)
            Sleep(300)
            Send("{ENTER}")
            Sleep(300)
        ;Else
        ;   MsgBox(0, "Error", "Failed to run Telnet for server '" & $sline & "'!")
        EndIf
    ElseIf $i=2 Then
        If Ping($s_ip) > 0 Then
            $oie = _IECreate("")
            ;If $s_ip <> 0 Then
            ;EndIf
            Sleep(500)
            Send("{TAB}")
            Sleep(500)
            Send($s_ip)
            Sleep(300)
            Send("{ENTER}")
            Sleep(300)
        ;Else
        ;   MsgBox(0, "Error", "Failed to run Telnet for server '" & $sline & "'!")
        EndIf
    EndIf
EndFunc

Func _Tick()
    GUICtrlSetData($lab1,@HOUR & ":" & @MIN & ":" & @SEC & " " & @MON & "-" & @MDAY & "-" & @YEAR)
EndFunc

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

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

    No registered users viewing this page.

×
×
  • Create New...