Sign in to follow this  
Followers 0
CHOVIE

GUI Code Line Clean Up Help

44 posts in this topic

#1 ·  Posted (edited)

Good Day All,

I have written the below GUI but is there a way to make it smaller "the code". I mean to lessen the code .........

#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>
;==============================================================================
#EndRegion
#Region ### START Koda GUI section ### Form=E:\koda_1.7.3.0.1\Forms\CCTV.kxf
Opt("MustDeclareVars", 1)
Global $1, $2, $3, $4, $bft, $bft1, $bftarc, $bftraid, $bftrmt, $bftrmt1, $cctv, $config, $corp, $corp1, $corparc, $corpraid, $corprmt
Global $corprmt1, $ct, $ct1, $ctarc, $ctraid, $ctrmt, $ctrmt1, $dbn, $dbn1, $dbnarc, $dbnarc_selection, $dbnraid, $dbnrmt, $dbnrmt1, $el, $el1, $elarc
Global $elraid, $elrmt, $elrmt1, $file, $htab, $icurrtab, $iexpl, $ilasttab, $ipaddress1, $ipaddress2, $result, $s_ip, $jnbarc_selection, $ctarc_selection
Global $ipaddress3, $jnb, $jnb1, $jnbarc, $jnbraid, $jnbrmt, $jnbrmt1, $lab1, $lab2, $lab3, $macadd, $nmsg, $oie, $pass, $pe, $pearc_selection, $elarc_selection
Global $pe1, $pearc, $peraid, $permt, $permt1, $pingb, $pingb1, $pingjnb, $ut, $ut1, $utarc, $utraid, $utrmt, $utrmt1, $sfilespec, $sline, $swindowtitle
Global $utarc_selection, $jnbrmt_selection, $s_ip1, $lab4, $error, $bftarc_selection, $config1, $config2, $config3, $ctrmt1_selection, $lab5, $dbnrmt1_selection, $note
;=================== VAR ======================================================
Global $s_data15 = "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15"
Global $s_data25 = $s_data15 & "|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25 "
Global $s_data35 = $s_data25 & "|ARC 26|ARC 27|ARC 28|ARC 29|ARC 30|ARC 31|ARC 32|ARC 33|ARC 34|ARC 35"
Global $s_data45 = $s_data35 & "|ARC 36|ARC 37|ARC 38|ARC 39|ARC 40|ARC 41|ARC 42|ARC 43|ARC 44|ARC 45"
Global $s_data50 = $s_data45 & "|ARC 46|ARC 47|ARC 48|ARC 49|ARC 50"
;==============================================================================
Global $s1_data15 = "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15"
Global $s1_data25 = $s1_data15 & "|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25 "
Global $s1_data35 = $s1_data25 & "|ARC 26|ARC 27|ARC 28|ARC 29|ARC 30|ARC 31|ARC 32|ARC 33|ARC 34|ARC 35"
Global $s1_data45 = $s1_data35 & "|ARC 36|ARC 37|ARC 38|ARC 39|ARC 40|ARC 41|ARC 42|ARC 43|ARC 44|ARC 45"
Global $s1_data50 = $s1_data45 & "|ARC 46|ARC 47|ARC 48|ARC 49|ARC 50"
;=================== GUI ======================================================
$cctv = GUICreate("SERVERS", 580, 345, 193, 128)
$htab = GUICtrlCreateTab(10, 10, 560, 325)
$1 = _GUICtrlTab_InsertItem($htab, 0, "ARCHIVERS")
$2 = _GUICtrlTab_InsertItem($htab, 1, "RAIDS")
$3 = _GUICtrlTab_InsertItem($htab, 2, "REMOTE")
$4 = _GUICtrlTab_InsertItem($htab, 3, "EXTRAS")
;=================== LABLES ======================================================
$lab1 = GUICtrlCreateLabel("" & "" & @HOUR & ":" & @MIN & ":" & @SEC & " " & @MON & "-" & @MDAY & "-" & @YEAR, 474, 295, 90, 30)
$lab2 = GUICtrlCreateLabel("Telnet Cameras", 14, 240, 80, 15)
GUICtrlSetState($lab2, $gui_hide)
$lab3 = GUICtrlCreateLabel("Ping Cameras", 14, 280, 80, 15)
GUICtrlSetState($lab3, $gui_hide)
$lab4 = GUICtrlCreateLabel("IEXPL Cameras", 14, 200, 80, 15)
GUICtrlSetState($lab4, $gui_hide)
$lab5 = GUICtrlCreateLabel("Configurators", 14, 76, 80, 15)
GUICtrlSetState($lab5, $gui_hide)
;=================== BUTTONS ======================================================
$jnb = GUICtrlCreateButton("JNB - A", 14, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
$ct = GUICtrlCreateButton("CT - A", 84, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
$dbn = GUICtrlCreateButton("DBN - A", 154, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
$pe = GUICtrlCreateButton("PE - A", 224, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
$el = GUICtrlCreateButton("EL - A", 294, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
$ut = GUICtrlCreateButton("UT - A", 364, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
$bft = GUICtrlCreateButton("BFT - A", 434, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
$corp = GUICtrlCreateButton("CORP - A", 504, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;=============================================================================================
$jnbarc = GUICtrlCreateCombo("Record", 14, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s_data50)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$ctarc = GUICtrlCreateCombo("Record", 84, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s_data50)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$dbnarc = GUICtrlCreateCombo("Record", 154, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s_data25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$pearc = GUICtrlCreateCombo("Record", 224, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$elarc = GUICtrlCreateCombo("Record", 294, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$utarc = GUICtrlCreateCombo("Record", 364, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$bftarc = GUICtrlCreateCombo("Record", 434, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$corparc = GUICtrlCreateCombo("Record", 504, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;================================================================================================
$jnb1 = GUICtrlCreateButton("OK", 14, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
$ct1 = GUICtrlCreateButton("OK", 84, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
$dbn1 = GUICtrlCreateButton("OK", 154, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
$pe1 = GUICtrlCreateButton("OK", 224, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
$el1 = GUICtrlCreateButton("OK", 294, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
$ut1 = GUICtrlCreateButton("OK", 364, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
$bft1 = GUICtrlCreateButton("OK", 434, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
$corp1 = GUICtrlCreateButton("OK", 504, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;===================================================================================
$jnbraid = GUICtrlCreateButton("JNB - R", 14, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
GUICtrlSetState($jnbraid, $gui_hide)
$ctraid = GUICtrlCreateButton("CT - R", 84, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
GUICtrlSetState($ctraid, $gui_hide)
$dbnraid = GUICtrlCreateButton("DBN - R", 154, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
GUICtrlSetState($dbnraid, $gui_hide)
$peraid = GUICtrlCreateButton("PE - R", 224, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
GUICtrlSetState($peraid, $gui_hide)
$elraid = GUICtrlCreateButton("EL - R", 294, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
GUICtrlSetState($elraid, $gui_hide)
$utraid = GUICtrlCreateButton("UT - R", 364, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
GUICtrlSetState($utraid, $gui_hide)
$bftraid = GUICtrlCreateButton("BFT - R", 434, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
GUICtrlSetState($bftraid, $gui_hide)
$corpraid = GUICtrlCreateButton("CORP - R", 504, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
GUICtrlSetState($corpraid, $gui_hide)
;=============================================================================================
$jnbrmt = GUICtrlCreateCombo("Remote", 14, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s1_data45)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
GUICtrlSetState($jnbrmt, $gui_hide)
$ctrmt = GUICtrlCreateCombo("Remote", 84, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s1_data35)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
GUICtrlSetState($ctrmt, $gui_hide)
$dbnrmt = GUICtrlCreateCombo("Remote", 154, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s1_data25)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
GUICtrlSetState($dbnrmt, $gui_hide)
$permt = GUICtrlCreateCombo("Remote", 224, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s1_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
GUICtrlSetState($permt, $gui_hide)
$elrmt = GUICtrlCreateCombo("Remote", 294, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s1_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
GUICtrlSetState($elrmt, $gui_hide)
$utrmt = GUICtrlCreateCombo("Remote", 364, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s1_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
GUICtrlSetState($utrmt, $gui_hide)
$bftrmt = GUICtrlCreateCombo("Remote", 434, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s1_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
GUICtrlSetState($bftrmt, $gui_hide)
$corprmt = GUICtrlCreateCombo("Remote", 504, 85, 60, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
GUICtrlSetData(-1, $s1_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
GUICtrlSetState($corprmt, $gui_hide)
;=================================================================================================
$jnbrmt1 = GUICtrlCreateButton("OK", 14, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
GUICtrlSetState($jnbrmt1, $gui_hide)
$ctrmt1 = GUICtrlCreateButton("OK", 84, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
GUICtrlSetState($ctrmt1, $gui_hide)
$dbnrmt1 = GUICtrlCreateButton("OK", 154, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
GUICtrlSetState($dbnrmt1, $gui_hide)
$permt1 = GUICtrlCreateButton("OK", 224, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
GUICtrlSetState($permt1, $gui_hide)
$elrmt1 = GUICtrlCreateButton("OK", 294, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
GUICtrlSetState($elrmt1, $gui_hide)
$utrmt1 = GUICtrlCreateButton("OK", 364, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
GUICtrlSetState($utrmt1, $gui_hide)
$bftrmt1 = GUICtrlCreateButton("OK", 434, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
GUICtrlSetState($bftrmt1, $gui_hide)
$corprmt1 = GUICtrlCreateButton("OK", 504, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
GUICtrlSetState($corprmt1, $gui_hide)
;==========================================================================
$config = GUICtrlCreateButton("V5.0", 14, 90, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetState($config, $gui_hide)
$config1 = GUICtrlCreateButton("V5.3", 79, 90, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetState($config1, $gui_hide)
$config2 = GUICtrlCreateButton("V6.0", 144, 90, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetState($config2, $gui_hide)
$config3 = GUICtrlCreateButton("V6.1", 209, 90, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetState($config3, $gui_hide)
;===========================================================================
$macadd = GUICtrlCreateButton("TELNET", 14, 50, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetState($macadd, $gui_hide)
$note = GUICtrlCreateButton("NOTEPAD", 79, 50, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetState($note, $gui_hide)
$pingb = GUICtrlCreateButton("GO", 145, 295, 40, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 2842846)
GUICtrlSetState($pingb, $gui_hide)
$pingb1 = GUICtrlCreateButton("GO", 145, 255, 40, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetState($pingb1, $gui_hide)
$pingjnb = GUICtrlCreateButton("SVR PING", 14, 120, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetState($pingjnb, $gui_hide)
$ipaddress1 = _GUICtrlIpAddress_Create($cctv, 14, 295, 130, 25)
_GUICtrlIpAddress_Set($ipaddress1, "0.0.0.0")
_GUICtrlIpAddress_ShowHide($ipaddress1, @SW_HIDE)
$ipaddress2 = _GUICtrlIpAddress_Create($cctv, 14, 255, 130, 25)
_GUICtrlIpAddress_Set($ipaddress2, "0.0.0.0")
_GUICtrlIpAddress_ShowHide($ipaddress2, @SW_HIDE)
$ipaddress3 = _GUICtrlIpAddress_Create($cctv, 14, 215, 130, 25)
_GUICtrlIpAddress_Set($ipaddress3, "0.0.0.0")
_GUICtrlIpAddress_ShowHide($ipaddress3, @SW_HIDE)
$iexpl = GUICtrlCreateButton("GO", 145, 215, 40, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 2842846)
GUICtrlSetState($iexpl, $gui_hide)
$ilasttab = 0
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

While 1
    $nmsg = GUIGetMsg()
    Switch $nmsg
        Case $gui_event_close
            Exit
    EndSwitch
    ;===============================================================;
    ;                                                               ;
    ;   Button Functions go here!!!!!!!!                            ;
    ;                                                               ;
    ;===============================================================;

    $icurrtab = _GUICtrlTab_GetCurFocus($htab)
    If $icurrtab <> $ilasttab Then
        $ilasttab = $icurrtab
        Switch $icurrtab
            Case 0
                GUICtrlSetState($jnb, $gui_show)
                GUICtrlSetState($ct, $gui_show)
                GUICtrlSetState($dbn, $gui_show)
                GUICtrlSetState($pe, $gui_show)
                GUICtrlSetState($el, $gui_show)
                GUICtrlSetState($ut, $gui_show)
                GUICtrlSetState($bft, $gui_show)
                GUICtrlSetState($corp, $gui_show)
                GUICtrlSetState($jnbarc, $gui_show)
                GUICtrlSetState($ctarc, $gui_show)
                GUICtrlSetState($dbnarc, $gui_show)
                GUICtrlSetState($pearc, $gui_show)
                GUICtrlSetState($elarc, $gui_show)
                GUICtrlSetState($utarc, $gui_show)
                GUICtrlSetState($bftarc, $gui_show)
                GUICtrlSetState($corparc, $gui_show)
                GUICtrlSetState($jnbraid, $gui_hide)
                GUICtrlSetState($ctraid, $gui_hide)
                GUICtrlSetState($dbnraid, $gui_hide)
                GUICtrlSetState($peraid, $gui_hide)
                GUICtrlSetState($elraid, $gui_hide)
                GUICtrlSetState($utraid, $gui_hide)
                GUICtrlSetState($bftraid, $gui_hide)
                GUICtrlSetState($corpraid, $gui_hide)
                GUICtrlSetState($pingb, $gui_hide)
                GUICtrlSetState($pingjnb, $gui_hide)
                GUICtrlSetState($config, $gui_hide)
                GUICtrlSetState($config1, $gui_hide)
                GUICtrlSetState($config2, $gui_hide)
                GUICtrlSetState($config3, $gui_hide)
                GUICtrlSetState($macadd, $gui_hide)
                GUICtrlSetState($note, $gui_hide)
                GUICtrlSetState($jnb1, $gui_show)
                GUICtrlSetState($ct1, $gui_show)
                GUICtrlSetState($dbn1, $gui_show)
                GUICtrlSetState($pe1, $gui_show)
                GUICtrlSetState($el1, $gui_show)
                GUICtrlSetState($ut1, $gui_show)
                GUICtrlSetState($bft1, $gui_show)
                GUICtrlSetState($corp1, $gui_show)
                GUICtrlSetState($jnbrmt, $gui_hide)
                GUICtrlSetState($ctrmt, $gui_hide)
                GUICtrlSetState($dbnrmt, $gui_hide)
                GUICtrlSetState($permt, $gui_hide)
                GUICtrlSetState($elrmt, $gui_hide)
                GUICtrlSetState($utrmt, $gui_hide)
                GUICtrlSetState($bftrmt, $gui_hide)
                GUICtrlSetState($corprmt, $gui_hide)
                GUICtrlSetState($jnbrmt1, $gui_hide)
                GUICtrlSetState($ctrmt1, $gui_hide)
                GUICtrlSetState($dbnrmt1, $gui_hide)
                GUICtrlSetState($permt1, $gui_hide)
                GUICtrlSetState($elrmt1, $gui_hide)
                GUICtrlSetState($utrmt1, $gui_hide)
                GUICtrlSetState($bftrmt1, $gui_hide)
                GUICtrlSetState($corprmt1, $gui_hide)
                GUICtrlSetState($pingb1, $gui_hide)
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_HIDE)
                GUICtrlSetState($lab2, $gui_hide)
                GUICtrlSetState($lab3, $gui_hide)
                GUICtrlSetState($lab4, $gui_hide)
                GUICtrlSetState($lab5, $gui_hide)
                GUICtrlSetState($iexpl, $gui_hide)
            Case 1
                GUICtrlSetState($jnb, $gui_hide)
                GUICtrlSetState($ct, $gui_hide)
                GUICtrlSetState($dbn, $gui_hide)
                GUICtrlSetState($pe, $gui_hide)
                GUICtrlSetState($el, $gui_hide)
                GUICtrlSetState($ut, $gui_hide)
                GUICtrlSetState($bft, $gui_hide)
                GUICtrlSetState($corp, $gui_hide)
                GUICtrlSetState($jnbarc, $gui_hide)
                GUICtrlSetState($ctarc, $gui_hide)
                GUICtrlSetState($dbnarc, $gui_hide)
                GUICtrlSetState($pearc, $gui_hide)
                GUICtrlSetState($elarc, $gui_hide)
                GUICtrlSetState($utarc, $gui_hide)
                GUICtrlSetState($bftarc, $gui_hide)
                GUICtrlSetState($corparc, $gui_hide)
                GUICtrlSetState($jnbraid, $gui_show)
                GUICtrlSetState($ctraid, $gui_show)
                GUICtrlSetState($dbnraid, $gui_show)
                GUICtrlSetState($peraid, $gui_show)
                GUICtrlSetState($elraid, $gui_show)
                GUICtrlSetState($utraid, $gui_show)
                GUICtrlSetState($bftraid, $gui_show)
                GUICtrlSetState($corpraid, $gui_show)
                GUICtrlSetState($pingb, $gui_hide)
                GUICtrlSetState($pingjnb, $gui_hide)
                GUICtrlSetState($config, $gui_hide)
                GUICtrlSetState($config1, $gui_hide)
                GUICtrlSetState($config2, $gui_hide)
                GUICtrlSetState($config3, $gui_hide)
                GUICtrlSetState($macadd, $gui_hide)
                GUICtrlSetState($note, $gui_hide)
                GUICtrlSetState($jnb1, $gui_hide)
                GUICtrlSetState($ct1, $gui_hide)
                GUICtrlSetState($dbn1, $gui_hide)
                GUICtrlSetState($pe1, $gui_hide)
                GUICtrlSetState($el1, $gui_hide)
                GUICtrlSetState($ut1, $gui_hide)
                GUICtrlSetState($bft1, $gui_hide)
                GUICtrlSetState($corp1, $gui_hide)
                GUICtrlSetState($jnbrmt, $gui_hide)
                GUICtrlSetState($ctrmt, $gui_hide)
                GUICtrlSetState($dbnrmt, $gui_hide)
                GUICtrlSetState($permt, $gui_hide)
                GUICtrlSetState($elrmt, $gui_hide)
                GUICtrlSetState($utrmt, $gui_hide)
                GUICtrlSetState($bftrmt, $gui_hide)
                GUICtrlSetState($corprmt, $gui_hide)
                GUICtrlSetState($jnbrmt1, $gui_hide)
                GUICtrlSetState($ctrmt1, $gui_hide)
                GUICtrlSetState($dbnrmt1, $gui_hide)
                GUICtrlSetState($permt1, $gui_hide)
                GUICtrlSetState($elrmt1, $gui_hide)
                GUICtrlSetState($utrmt1, $gui_hide)
                GUICtrlSetState($bftrmt1, $gui_hide)
                GUICtrlSetState($corprmt1, $gui_hide)
                GUICtrlSetState($pingb1, $gui_hide)
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_HIDE)
                GUICtrlSetState($lab2, $gui_hide)
                GUICtrlSetState($lab3, $gui_hide)
                GUICtrlSetState($lab4, $gui_hide)
                GUICtrlSetState($lab5, $gui_hide)
                GUICtrlSetState($iexpl, $gui_hide)
            Case 2
                GUICtrlSetState($jnb, $gui_hide)
                GUICtrlSetState($ct, $gui_hide)
                GUICtrlSetState($dbn, $gui_hide)
                GUICtrlSetState($pe, $gui_hide)
                GUICtrlSetState($el, $gui_hide)
                GUICtrlSetState($ut, $gui_hide)
                GUICtrlSetState($bft, $gui_hide)
                GUICtrlSetState($corp, $gui_hide)
                GUICtrlSetState($jnbarc, $gui_hide)
                GUICtrlSetState($ctarc, $gui_hide)
                GUICtrlSetState($dbnarc, $gui_hide)
                GUICtrlSetState($pearc, $gui_hide)
                GUICtrlSetState($elarc, $gui_hide)
                GUICtrlSetState($utarc, $gui_hide)
                GUICtrlSetState($bftarc, $gui_hide)
                GUICtrlSetState($corparc, $gui_hide)
                GUICtrlSetState($jnbraid, $gui_hide)
                GUICtrlSetState($ctraid, $gui_hide)
                GUICtrlSetState($dbnraid, $gui_hide)
                GUICtrlSetState($peraid, $gui_hide)
                GUICtrlSetState($elraid, $gui_hide)
                GUICtrlSetState($utraid, $gui_hide)
                GUICtrlSetState($bftraid, $gui_hide)
                GUICtrlSetState($corpraid, $gui_hide)
                GUICtrlSetState($pingb, $gui_hide)
                GUICtrlSetState($pingjnb, $gui_hide)
                GUICtrlSetState($config, $gui_hide)
                GUICtrlSetState($config1, $gui_hide)
                GUICtrlSetState($config2, $gui_hide)
                GUICtrlSetState($config3, $gui_hide)
                GUICtrlSetState($macadd, $gui_hide)
                GUICtrlSetState($note, $gui_hide)
                GUICtrlSetState($jnb1, $gui_hide)
                GUICtrlSetState($ct1, $gui_hide)
                GUICtrlSetState($dbn1, $gui_hide)
                GUICtrlSetState($pe1, $gui_hide)
                GUICtrlSetState($el1, $gui_hide)
                GUICtrlSetState($ut1, $gui_hide)
                GUICtrlSetState($bft1, $gui_hide)
                GUICtrlSetState($corp1, $gui_hide)
                GUICtrlSetState($jnbrmt, $gui_show)
                GUICtrlSetState($ctrmt, $gui_show)
                GUICtrlSetState($dbnrmt, $gui_show)
                GUICtrlSetState($permt, $gui_show)
                GUICtrlSetState($elrmt, $gui_show)
                GUICtrlSetState($utrmt, $gui_show)
                GUICtrlSetState($bftrmt, $gui_show)
                GUICtrlSetState($corprmt, $gui_show)
                GUICtrlSetState($jnbrmt1, $gui_show)
                GUICtrlSetState($ctrmt1, $gui_show)
                GUICtrlSetState($dbnrmt1, $gui_show)
                GUICtrlSetState($permt1, $gui_show)
                GUICtrlSetState($elrmt1, $gui_show)
                GUICtrlSetState($utrmt1, $gui_show)
                GUICtrlSetState($bftrmt1, $gui_show)
                GUICtrlSetState($corprmt1, $gui_show)
                GUICtrlSetState($pingb1, $gui_hide)
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_HIDE)
                GUICtrlSetState($lab2, $gui_hide)
                GUICtrlSetState($lab3, $gui_hide)
                GUICtrlSetState($lab4, $gui_hide)
                GUICtrlSetState($lab5, $gui_hide)
                GUICtrlSetState($iexpl, $gui_hide)
            Case 3
                GUICtrlSetState($jnb, $gui_hide)
                GUICtrlSetState($ct, $gui_hide)
                GUICtrlSetState($dbn, $gui_hide)
                GUICtrlSetState($pe, $gui_hide)
                GUICtrlSetState($el, $gui_hide)
                GUICtrlSetState($ut, $gui_hide)
                GUICtrlSetState($bft, $gui_hide)
                GUICtrlSetState($corp, $gui_hide)
                GUICtrlSetState($jnbarc, $gui_hide)
                GUICtrlSetState($ctarc, $gui_hide)
                GUICtrlSetState($dbnarc, $gui_hide)
                GUICtrlSetState($pearc, $gui_hide)
                GUICtrlSetState($elarc, $gui_hide)
                GUICtrlSetState($utarc, $gui_hide)
                GUICtrlSetState($bftarc, $gui_hide)
                GUICtrlSetState($corparc, $gui_hide)
                GUICtrlSetState($jnbraid, $gui_hide)
                GUICtrlSetState($ctraid, $gui_hide)
                GUICtrlSetState($dbnraid, $gui_hide)
                GUICtrlSetState($peraid, $gui_hide)
                GUICtrlSetState($elraid, $gui_hide)
                GUICtrlSetState($utraid, $gui_hide)
                GUICtrlSetState($bftraid, $gui_hide)
                GUICtrlSetState($corpraid, $gui_hide)
                GUICtrlSetState($pingb, $gui_show)
                GUICtrlSetState($pingjnb, $gui_show)
                GUICtrlSetState($config, $gui_show)
                GUICtrlSetState($config1, $gui_show)
                GUICtrlSetState($config2, $gui_show)
                GUICtrlSetState($config3, $gui_show)
                GUICtrlSetState($macadd, $gui_show)
                GUICtrlSetState($note, $gui_show)
                GUICtrlSetState($jnb1, $gui_hide)
                GUICtrlSetState($ct1, $gui_hide)
                GUICtrlSetState($dbn1, $gui_hide)
                GUICtrlSetState($pe1, $gui_hide)
                GUICtrlSetState($el1, $gui_hide)
                GUICtrlSetState($ut1, $gui_hide)
                GUICtrlSetState($bft1, $gui_hide)
                GUICtrlSetState($corp1, $gui_hide)
                GUICtrlSetState($jnbrmt, $gui_hide)
                GUICtrlSetState($ctrmt, $gui_hide)
                GUICtrlSetState($dbnrmt, $gui_hide)
                GUICtrlSetState($permt, $gui_hide)
                GUICtrlSetState($elrmt, $gui_hide)
                GUICtrlSetState($utrmt, $gui_hide)
                GUICtrlSetState($bftrmt, $gui_hide)
                GUICtrlSetState($corprmt, $gui_hide)
                GUICtrlSetState($jnbrmt1, $gui_hide)
                GUICtrlSetState($ctrmt1, $gui_hide)
                GUICtrlSetState($dbnrmt1, $gui_hide)
                GUICtrlSetState($permt1, $gui_hide)
                GUICtrlSetState($elrmt1, $gui_hide)
                GUICtrlSetState($utrmt1, $gui_hide)
                GUICtrlSetState($bftrmt1, $gui_hide)
                GUICtrlSetState($corprmt1, $gui_hide)
                GUICtrlSetState($pingb1, $gui_show)
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_SHOW)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_SHOW)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_SHOW)
                GUICtrlSetState($lab2, $gui_show)
                GUICtrlSetState($lab3, $gui_show)
                GUICtrlSetState($lab4, $gui_show)
                GUICtrlSetState($lab5, $gui_show)
                GUICtrlSetState($iexpl, $gui_show)
        EndSwitch
    EndIf

WEnd

Thanks in advance .......

Regards,

CHOVIE

Edited by CHOVIE

..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites



:)

well, first use the original GUICtrlCreateTab and GUICtrlCreateTabItem functions and put the stuff in the right tabs ....


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

Share this post


Link to post
Share on other sites

:)

well, first use the original GUICtrlCreateTab and GUICtrlCreateTabItem functions and put the stuff in the right tabs ....

 I do not understand what you mean ... the GUI works perfectly and I just want to know is there a way to put the below "example"....

Case 3
                GUICtrlSetState($jnb, $gui_hide)
                GUICtrlSetState($ct, $gui_hide)
                GUICtrlSetState($dbn, $gui_hide)
                GUICtrlSetState($pe, $gui_hide)
                GUICtrlSetState($el, $gui_hide)
                GUICtrlSetState($ut, $gui_hide)
                GUICtrlSetState($bft, $gui_hide)
                GUICtrlSetState($corp, $gui_hide)
                GUICtrlSetState($jnbarc, $gui_hide)
                GUICtrlSetState($ctarc, $gui_hide)
                GUICtrlSetState($dbnarc, $gui_hide)
                GUICtrlSetState($pearc, $gui_hide)
                GUICtrlSetState($elarc, $gui_hide)
                GUICtrlSetState($utarc, $gui_hide)
                GUICtrlSetState($bftarc, $gui_hide)
                GUICtrlSetState($corparc, $gui_hide)
                GUICtrlSetState($jnbraid, $gui_hide)
                GUICtrlSetState($ctraid, $gui_hide)
                GUICtrlSetState($dbnraid, $gui_hide)
                GUICtrlSetState($peraid, $gui_hide)
                GUICtrlSetState($elraid, $gui_hide)
                GUICtrlSetState($utraid, $gui_hide)
                GUICtrlSetState($bftraid, $gui_hide)
                GUICtrlSetState($corpraid, $gui_hide)
                GUICtrlSetState($pingb, $gui_show)
                GUICtrlSetState($pingjnb, $gui_show)
                GUICtrlSetState($config, $gui_show)
                GUICtrlSetState($config1, $gui_show)
                GUICtrlSetState($config2, $gui_show)
                GUICtrlSetState($config3, $gui_show)
                GUICtrlSetState($macadd, $gui_show)
                GUICtrlSetState($note, $gui_show)
                GUICtrlSetState($jnb1, $gui_hide)
                GUICtrlSetState($ct1, $gui_hide)
                GUICtrlSetState($dbn1, $gui_hide)
                GUICtrlSetState($pe1, $gui_hide)
                GUICtrlSetState($el1, $gui_hide)
                GUICtrlSetState($ut1, $gui_hide)
                GUICtrlSetState($bft1, $gui_hide)
                GUICtrlSetState($corp1, $gui_hide)
                GUICtrlSetState($jnbrmt, $gui_hide)
                GUICtrlSetState($ctrmt, $gui_hide)
                GUICtrlSetState($dbnrmt, $gui_hide)
                GUICtrlSetState($permt, $gui_hide)
                GUICtrlSetState($elrmt, $gui_hide)
                GUICtrlSetState($utrmt, $gui_hide)
                GUICtrlSetState($bftrmt, $gui_hide)
                GUICtrlSetState($corprmt, $gui_hide)
                GUICtrlSetState($jnbrmt1, $gui_hide)
                GUICtrlSetState($ctrmt1, $gui_hide)
                GUICtrlSetState($dbnrmt1, $gui_hide)
                GUICtrlSetState($permt1, $gui_hide)
                GUICtrlSetState($elrmt1, $gui_hide)
                GUICtrlSetState($utrmt1, $gui_hide)
                GUICtrlSetState($bftrmt1, $gui_hide)
                GUICtrlSetState($corprmt1, $gui_hide)
                GUICtrlSetState($pingb1, $gui_show)
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_SHOW)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_SHOW)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_SHOW)
                GUICtrlSetState($lab2, $gui_show)
                GUICtrlSetState($lab3, $gui_show)
                GUICtrlSetState($lab4, $gui_show)
                GUICtrlSetState($lab5, $gui_show)
                GUICtrlSetState($iexpl, $gui_show)

in to a one liner or not ...... thanx for the reply .....


..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

second i would use arrays for the controls and loops

and third i would not use MustDeclareVars, the controls are global anyway.

and another thing i always do is, not giving variables to all controls, since autoit simply counts them on creation. the first control id is 1 and so on. so you can give a variable to the first control and the next one will be one number higher.

E. :)


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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

from the helpfile:

.

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $tab
    Local $msg

    GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    $tab = GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    GUICtrlCreateButton("OK0", 20, 50, 50, 20)
    GUICtrlCreateInput("default", 80, 50, 70, 20)

    GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
    GUICtrlCreateButton("OK1", 80, 50, 50, 20)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW); will be display first
    GUICtrlCreateLabel("label2", 30, 80, 50, 20)
    GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem(""); end tabitem definition

    GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        If $msg = $tab Then
            ; display the clicked tab
            WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab))
        EndIf
    WEnd
EndFunc   ;==>Example

.

try it

 

it doesn't require tab managment, not even a single line

Edited by Edano

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

Share this post


Link to post
Share on other sites

@ Edano,

Thanx for the assistance on this matter, I have redone the GUI and the code lines is looking a lot better ........

 

 "second i would use arrays for the controls and loops"  I do not understand arrays

"and third i would not use MustDeclareVars, the controls are global anyway." Removed ...... Thanx understand ..... :thumbsup:

"and another thing i always do is, not giving variables to all controls, since autoit simply counts them on creation. the first control id is 1 and so on. so you can give a variable to the first control and the next one will be one number higher." Please give me a sample from my script so that I can see

#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>
;==============================================================================
#EndRegion
#Region ### START Koda GUI section ### Form=E:\koda_1.7.3.0.1\Forms\CCTV.kxf
Global $1, $2, $3, $4, $bft, $bft1, $bftarc, $bftraid, $bftrmt, $bftrmt1, $cctv, $config, $corp, $corp1, $corparc, $corpraid, $corprmt
Global $corprmt1, $ct, $ct1, $ctarc, $ctraid, $ctrmt, $ctrmt1, $dbn, $dbn1, $dbnarc, $dbnarc_selection, $dbnraid, $dbnrmt, $dbnrmt1, $el, $el1, $elarc
Global $elraid, $elrmt, $elrmt1, $file, $htab, $icurrtab, $iexpl, $ilasttab, $ipaddress1, $ipaddress2, $result, $s_ip, $jnbarc_selection, $ctarc_selection
Global $ipaddress3, $jnb, $jnb1, $jnbarc, $jnbraid, $jnbrmt, $jnbrmt1, $lab1, $lab2, $lab3, $macadd, $nmsg, $oie, $pass, $pe, $pearc_selection, $elarc_selection
Global $pe1, $pearc, $peraid, $permt, $permt1, $pingb, $pingb1, $pingjnb, $ut, $ut1, $utarc, $utraid, $utrmt, $utrmt1, $sfilespec, $sline, $swindowtitle
Global $utarc_selection, $jnbrmt_selection, $s_ip1, $lab4, $error, $bftarc_selection, $config1, $config2, $config3, $ctrmt1_selection, $lab5, $dbnrmt1_selection, $note

;=================== VAR ======================================================
Global $s_data15 = "SVR 1|SVR 2|SVR 3|SVR 4|SVR 5|SVR 6|SVR 7|SVR 8|SVR 9|SVR 10|SVR 11|SVR 12|SVR 13|SVR 14|SVR 15"
Global $s_data25 = $s_data15 & "|SVR 16|SVR 17|SVR 18|SVR 19|SVR 20|SVR 21|SVR 22|SVR 23|SVR 24|SVR 25 "
Global $s_data35 = $s_data25 & "|SVR 26|SVR 27|SVR 28|SVR 29|SVR 30|SVR 31|SVR 32|SVR 33|SVR 34|SVR 35"
Global $s_data45 = $s_data35 & "|SVR 36|SVR 37|SVR 38|SVR 39|SVR 40|SVR 41|SVR 42|SVR 43|SVR 44|SVR 45"
Global $s_data50 = $s_data45 & "|SVR 46|SVR 47|SVR 48|SVR 49|SVR 50"

$ilasttab = 0

;=================== GUI ======================================================
$cctv = GUICreate("SERVERS", 580, 345, 193, 128)
$lab1 = GUICtrlCreateLabel("" & "" & @HOUR & ":" & @MIN & ":" & @SEC & " " & @MON & "-" & @MDAY & "-" & @YEAR, 510, 300, 55, 30)
;===============================================
$htab = GUICtrlCreateTab(10, 10, 560, 325)
GUICtrlCreateTabItem("SERVERS")
;-------------------------------------------
GUICtrlCreateButton("SET 1", 14, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;-------------------------------------------
GUICtrlCreateButton("SET 2", 84, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;-------------------------------------------
GUICtrlCreateButton("SET 3", 154, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;-------------------------------------------
GUICtrlCreateButton("SET 4", 224, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;-------------------------------------------
GUICtrlCreateButton("SET 5", 294, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;-------------------------------------------
GUICtrlCreateButton("SET 6", 364, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;-------------------------------------------
GUICtrlCreateButton("SET 7", 434, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;-------------------------------------------
GUICtrlCreateButton("SET 8", 504, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)
;-------------------------------------------
GUICtrlCreateCombo("UNITS", 14, 85, 60, 25)
GUICtrlSetData(-1, $s_data50)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("UNITS", 84, 85, 60, 25)
GUICtrlSetData(-1, $s_data50)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("UNITS", 154, 85, 60, 25)
GUICtrlSetData(-1, $s_data25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("UNITS", 224, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("UNITS", 294, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("UNITS", 364, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("UNITS", 434, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("UNITS", 504, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
$jnb1 = GUICtrlCreateButton("OK", 14, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$ct1 = GUICtrlCreateButton("OK", 84, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$dbn1 = GUICtrlCreateButton("OK", 154, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$pe1 = GUICtrlCreateButton("OK", 224, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$el1 = GUICtrlCreateButton("OK", 294, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$ut1 = GUICtrlCreateButton("OK", 364, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$bft1 = GUICtrlCreateButton("OK", 434, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$corp1 = GUICtrlCreateButton("OK", 504, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;=========================================================
GUICtrlCreateTabItem("STORAGE")

$jnbraid = GUICtrlCreateButton("SAN 1", 14, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
;-------------------------------------------
$ctraid = GUICtrlCreateButton("SAN 2", 84, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
;-------------------------------------------
$dbnraid = GUICtrlCreateButton("SAN 3", 154, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
;-------------------------------------------
$peraid = GUICtrlCreateButton("SAN 4", 224, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
;-------------------------------------------
$elraid = GUICtrlCreateButton("SAN 5", 294, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
;-------------------------------------------
$utraid = GUICtrlCreateButton("SAN 6", 364, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
;-------------------------------------------
$bftraid = GUICtrlCreateButton("SAN 7", 434, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
;-------------------------------------------
$corpraid = GUICtrlCreateButton("SAN 8", 504, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 16776960)
;=========================================================
GUICtrlCreateTabItem("REMOTE")

GUICtrlCreateCombo("Remote", 14, 85, 60, 25)
GUICtrlSetData(-1, $s_data50)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("Remote", 84, 85, 60, 25)
GUICtrlSetData(-1, $s_data50)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("Remote", 154, 85, 60, 25)
GUICtrlSetData(-1, $s_data25)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("Remote", 224, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("Remote", 294, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("Remote", 364, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("Remote", 434, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
;-------------------------------------------
GUICtrlCreateCombo("Remote", 504, 85, 60, 25)
GUICtrlSetData(-1, $s_data15)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
;-------------------------------------------
$jnbrmt1 = GUICtrlCreateButton("OK", 14, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$ctrmt1 = GUICtrlCreateButton("OK", 84, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$dbnrmt1 = GUICtrlCreateButton("OK", 154, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$permt1 = GUICtrlCreateButton("OK", 224, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$elrmt1 = GUICtrlCreateButton("OK", 294, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$utrmt1 = GUICtrlCreateButton("OK", 364, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$bftrmt1 = GUICtrlCreateButton("OK", 434, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;-------------------------------------------
$corprmt1 = GUICtrlCreateButton("OK", 504, 110, 60, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 65280)
;=========================================================
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")
;-------------------------------------------
$ipaddress1 = _GUICtrlIpAddress_Create($cctv, 14, 295, 130, 25)
_GUICtrlIpAddress_Set($ipaddress1, "0.0.0.0")
_GUICtrlIpAddress_ShowHide($ipaddress1, @SW_HIDE)
;-------------------------------------------
$pingb = GUICtrlCreateButton("GO", 145, 295, 40, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 2842846)
;-------------------------------------------
$ipaddress2 = _GUICtrlIpAddress_Create($cctv, 14, 255, 130, 25)
_GUICtrlIpAddress_Set($ipaddress2, "0.0.0.0")
_GUICtrlIpAddress_ShowHide($ipaddress2, @SW_HIDE)
$pingb1 = GUICtrlCreateButton("GO", 145, 255, 40, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;-------------------------------------------
$ipaddress3 = _GUICtrlIpAddress_Create($cctv, 14, 215, 130, 25)
_GUICtrlIpAddress_Set($ipaddress3, "0.0.0.0")
_GUICtrlIpAddress_ShowHide($ipaddress3, @SW_HIDE)
$iexpl = GUICtrlCreateButton("GO", 145, 215, 40, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 2842846)
;-------------------------------------------
$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)
;-------------------------------------------


GUISetState(@SW_SHOW)

While 1
    $nmsg = GUIGetMsg()
    Switch $nmsg
        Case $gui_event_close
            Exit
    EndSwitch
    ;===============================================================;
    ;                                                               ;
    ;   Button Functions go here!!!!!!!!                            ;
    ;                                                               ;
    ;===============================================================;
    $icurrtab = _GUICtrlTab_GetCurFocus($htab)
    If $icurrtab <> $ilasttab Then
        $ilasttab = $icurrtab
        Switch $icurrtab
            Case 0
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_HIDE)
            Case 1
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_HIDE)
            Case 2
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_HIDE)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_HIDE)
            Case 3
                _GUICtrlIpAddress_ShowHide($ipaddress1, @SW_SHOW)
                _GUICtrlIpAddress_ShowHide($ipaddress2, @SW_SHOW)
                _GUICtrlIpAddress_ShowHide($ipaddress3, @SW_SHOW)
        EndSwitch
    EndIf
WEnd

I still need to take out some Global Var`s out ........

 

Thanx Again,

Regards,

CHOVIE


..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

excellent !

you got rid of half of the code at least :sweating: .very good. the rest is a bit advanced.

i won't teach you arrays (the things in "[ ]") and loops, therefore you have the helpfile and the forum examples.

but i give you an inspiring example to think about. a very short code with gui and 401 controls without variables and you still know each their ID. just try it, do some math and watch:

.

GUICreate("controls without names",500,400)

$tab=GUICtrlCreateTab(10,10,480,380)

For $i=1 To 100
    GUICtrlCreateTabItem("Tab#"&$i)
    GUICtrlCreateButton("Button#"&$i,20,50,80,30)
    GUICtrlSetBkColor(GUICtrlCreateLabel("Label#"&$i,20,90,80,30),0xFFFFFF)
    GUICtrlCreateCombo("Combo#"&$i,20,130,80,30)
Next

GUICtrlCreateTabItem("")

GUISetState()

Do
    $msg=GUIGetMsg()
    If $msg>0 And $msg<>$tab Then MsgBox(0,"","My control_ID is "&$msg-$tab&@CRLF&"and i am on Tab# "&Int($msg/4))
Until $msg=-3    ; ( $gui_event_close = -3 )

.

(i hope the forum police won't catch me o:) )

keep on coding E.

 

Edit: from the tabitem helpfile:

.

When advanced mode is used, GUICtrlRead($tab,1) will return the controlID instead of index of the clicked tab item.

.

i recommend you not to use the more complicated _GUICtrlTab_ functions yet. they are for advanced users. but it's okay if you want. they just need more attention than the basic controls.

Edited by Edano

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

Share this post


Link to post
Share on other sites

@ Edano,

Thanx once again for the advice on this matter .........

Looking at your sample this is great and saves a lot of time, but how do you make more than one button on a tab and hide other stuff for the other tabs. Lastly how do get the different buttons to work on different functions ......

 I appreciate all your efforts on assisting me on learning how all of this come together and how to look at things ...... people here expect you to know everything altough one has only started now with this..... The forum and help files are great if you know what they talking about, but it is the same if some else talks to you in a different language how are you going to understand this if no one teaches you how to speak it. It`s easy to say go and read up on it but where to start and where to finish ....... :think:

Like I said thank you for all your efforts on this ...... ;)

Regards,

CHOVIE


..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@ Edano

How would I find out which button it which in the scrip of mine because of me removing the below

Case $JNB
        $sfileSpec = "Filename"
    $file = FileOpen($sfileSpec, 0)
    If $file = -1 Then
    MsgBox(0, "Error", "Unable to open data file: '" & $sFileSpec & "'")
    Exit
EndIf

form the button ......

GUICtrlCreateButton("SET 1", 14, 45, 60, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 6075391)

I am correct in saying that I should use "SET 1" now in case of "$JNB" or is this totally wrong ....

Regards,

CHOVIE

Edited by CHOVIE

..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

you need to define

$JNB=GUICtrlCreateButton("SET 1", 14, 45, 60, 25)

in this case.





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

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Thanx,

Will give a it a try tomorrow .........  

EDIT: Is there any answer on the above post of mine ......... o:)  Please ....

Edited by CHOVIE

..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

;http://www.autoitscript.com/forum/topic/152875-gui-code-line-clean-up-help/#entry1098823
;Post #6
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\photo-thumb-58813.jpg
;by CHOVIE

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

#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]
;=================== 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)
;-------------------------------------------

_Tick()
AdlibRegister("_Tick",1000)

GUISetState()

Do
    $nmsg = GUIGetMsg()
    For $i=0 To 7
        ; .....
    ;   If $nmsg=$SetButton[$i] Then ; function
    ;   If $nmsg=$UnitsCombo[$i] Then ; function
    ;   If $nmsg=$OK1Button[$i] Then ; function
    ;   If $nmsg=$RaidButton[$i] Then ; function
        ; .....
    Next
    ;===============================================================;
    ;                                                               ;
    ;   Button Functions go here!!!!!!!!                            ;
    ;                                                               ;
    ;===============================================================;
    $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 _Tick()
    GUICtrlSetData($lab1,@HOUR & ":" & @MIN & ":" & @SEC & " " & @MON & "-" & @MDAY & "-" & @YEAR)
EndFunc

.

here ya go E.


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

Share this post


Link to post
Share on other sites

@ Edano

Thank you one again for all your efforts on this matter .......... :thumbsup:

So I using your script to try and see how it would work when a button is pressed to do the following ......

Do
    $nmsg = GUIGetMsg()
    For $i=0 To 7
        ; .....
      If $nmsg=$SetButton[$i] Then
            $sfilespec = "FILENAME"
            $file = FileOpen($sfilespec, 0)
            EndIf
            If $file = -1 Then
                MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'")
                Exit
            EndIf
            While 2
                $sline = FileReadLine($file)
                If @error = -1 Then ExitLoop
                $swindowtitle = "Telnet " & $sline
                $result = Run(@ComSpec & " /c telnet " & $sline)
                If $result <> 0 Then
                    Sleep(500)
                    WinActivate($swindowtitle)
                    Sleep(200)
                    Send("KEY")
                    Sleep(300)
                    Send("KEY")
                    Sleep(300)
                    Send("KEY")
                    Sleep(300)
                    Send("KEY")
                    Sleep(300)
                Else
                    MsgBox(0, "Error", "Failed to run Telnet for server '" & $sline & "'!")
                EndIf
            WEnd

but then it opens a telnet session as soon as I run the program even before I clicked the button and it does not read from the file to get the information from there .........

Otherwise the code is brilliant and is a lot shorter then what I know at this stage what to do .......

 

Regards,

CHOVIE


..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

$nmsg = GUIGetMsg()
    For $i=0 To 7
        ; .....
        If $nmsg=$SetButton[$i] Then

            ; you have to check what $i is clicked

            $sfilespec = "FILENAME"
            $file = FileOpen($sfilespec, 0)
            If $file = -1 Then
                MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'")
                ContinueLoop
            EndIf
            While 2
                $sline = FileReadLine($file)
                If @error = -1 Then ExitLoop
                $swindowtitle = "Telnet " & $sline
                $result = Run(@ComSpec & " /c telnet " & $sline)
                If $result <> 0 Then
                    Sleep(500)
                    WinActivate($swindowtitle)
                    Sleep(200)
                    Send("KEY")
                    Sleep(300)
                    Send("KEY")
                    Sleep(300)
                    Send("KEY")
                    Sleep(300)
                    Send("KEY")
                    Sleep(300)
                Else
                    MsgBox(0, "Error", "Failed to run Telnet for server '" & $sline & "'!")
                EndIf
            WEnd
        EndIf
    Next

.

you have a chaotic code. you have to go thru the lines and imagine what is wrong. use messageboxese to check where you are stuck.

E.


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

Share this post


Link to post
Share on other sites

@ Edano

 

HeeeHaaaaa ............. the first button is working now to get the rest to work .......... :construction:  Will let you know if I run into a brick wall ...........

:D  ;)  ^_^  B)  yet again thank you for your time and effort on this .......

Regards,

CHOVIE


..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

@ Edano

I can get the first two tab`s button numbers but when I try the third tab it shows "My control ID is -4 and I am on Tab# 0 " ...........

Do
    $nmsg = GUIGetMsg()
    For $i=0 To 7
If $OK2Button[$i] Then MsgBox(0,"","My control_ID is "&$nmsg-$htab&@CRLF&"and i am on Tab# "&Int($nmsg/4))
Next

Regards,

CHOVIE


..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

Ok ...... Ok ..... I am the stupid idiot :imwithstupid:   ..... can`t read properly ...... found the mistake instead of

If $OK2Button[$i] Then MsgBox(0,"","My control_ID is "&$nmsg-$htab&@CRLF&"and i am on Tab# "&Int($nmsg/4))

it should be

If $nmsg=$OK2Button[$i] Then MsgBox(0,"","My control_ID is "&$nmsg-$htab&@CRLF&"and i am on Tab# "&Int($nmsg/4))

CHOVIE


..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

@ Edano

After the creation of the below I know which button works where, but if you type in the ip "10.0.0.1" for example once you pres the button to go and read the ip you have typed in .......

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

this is the function ....

$s_ip = _GUICtrlIpAddress_Get(????????????)
    If Ping($s_ip) > 0 Then
    Run(@ComSpec & " /c telnet ")
    If $s_ip <> 0 Then

What do i type in place of the ??????????

 

Kind Regards,

CHOVIE


..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

@ Edano

After the creation of the below I know which button works where, but if you type in the ip "10.0.0.1" for example once you pres the button to go and read the ip you have typed in .......

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

this is the function ....

$s_ip = _GUICtrlIpAddress_Get(????????????)
    If Ping($s_ip) > 0 Then
    Run(@ComSpec & " /c telnet ")
    If $s_ip <> 0 Then

What do i type in place of the ??????????

 

Kind Regards,

CHOVIE

.

Hach chovie ....

we all began like you. it is trial and error, and from time to time one makes a progress....

you have an ARRAY of ipaddress controls and corresponding buttons.

the "names" of the corresponding controls are:

$ipaddress[0]  ====>  $PingButton[0]

$ipaddress[1]  ====>  $PingButton[1]

$ipaddress[2]  ====>  $PingButton[2]

the for..next loop checks them one after the other.... using $i as count that is used in brackets. now think...........

E.


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

Share this post


Link to post
Share on other sites

@ Edano

........ All three button functions working now ... :thumbsup:  :thumbsup:

Now to carry on with the other functions until I get stuck again .......

Once again thank you for your time and effort on this, I am starting to understand it a bit more now. This is how you get someone to understand the functions and all the other goodies of AutoIT .......

Regards,

CHOVIE


..... To Be The Best You Have To Beat The Best .....

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