Jump to content
Sign in to follow this  
Hok

Tabs Problem

Recommended Posts

Hok

Hey everyone,

I made this simple Server Status Checker, that can check the status of websites and IPs... obviously using the simple ping() command... But, I make the script make a new tab in the GUI, and the first time you go to that tab it gets all messed up. But if I go to a different tab then go back, it is fine. Here is the code:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\hdixon\Desktop\Folders\!Stuff\AUTOIT PROGRAMMING\Private Server Status\Koda.kxf
$Form1 = GUICreate("Private Server Status Checker", 436, 261, 234, 145)
$Tab1 = GUICtrlCreateTab(0, 50, 421, 186)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$TabSheet2 = GUICtrlCreateTabItem("Add New Server")
GUICtrlSetState(-1,$GUI_SHOW)
$InputServerName = GUICtrlCreateInput("Type the name of the server here...", 10, 125, 391, 21)
$Label3 = GUICtrlCreateLabel("Add New Server", 15, 80, 161, 37)
GUICtrlSetFont(-1, 16, 400, 0, "Papyrus")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$InputServerIP = GUICtrlCreateInput("Type the IP of the server here..", 10, 150, 391, 21)
$AddServer = GUICtrlCreateButton("Add Server", 15, 180, 381, 36, 0)
GUICtrlCreateTabItem("")
$Label2 = GUICtrlCreateLabel("Private Server Status Checker", 0, 0, 411, 42)
GUICtrlSetFont(-1, 22, 400, 0, "Papyrus")
$Form1context = GUICtrlCreateContextMenu()
$MenuItem1 = GUICtrlCreateMenuItem("Help", $Form1context)
$MenuItem2 = GUICtrlCreateMenuItem("Credits", $Form1context)
$MenuItem3 = GUICtrlCreateMenuItem("PwnCo", $Form1context)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $MenuItem1
    MsgBox(64, "Server Status Checker", "To add another server, go to the Add Server Tab, write in the name and IP address of the server, and then press Add Server.")
Case $MenuItem2
    MsgBox(64, "Server Status Checker", "Scripting: Hok/Snipe/LightByte (gogogadgethd@gmail.com)")
Case $MenuItem3
    MsgBox(64, "Server Status Checker", "PwnCo is at http://pwnco.niceboard.net")
Case $AddServer
    Add()
Case $TabSheet2
    Pinga()
        
        
EndSwitch
WEnd

Func Add()
    $Name=GuiCtrlRead($InputServerName)
    $IP=GuiCtrlRead($InputServerIP)
    $TabSheet1 = GUICtrlCreateTabItem(""&$Name)
    Pinga()
    
EndFunc

Func Pinga()
    $Name=GuiCtrlRead($InputServerName)
    $IP=GuiCtrlRead($InputServerIP)
$PwnPing=ping("" &$IP)
    If $PwnPing>0 then 
        $Label1 = GUICtrlCreateLabel("Status: Online", 5, 130, 406, 97)
        GUICtrlSetFont(-1, 36, 800, 2, "Papyrus")
    Else
        $Label1 = GUICtrlCreateLabel("Status: Offline", 5, 130, 406, 97)
        GUICtrlSetFont(-1, 36, 800, 2, "Papyrus")
    EndIf
EndFunc

Share this post


Link to post
Share on other sites
martin

Hey everyone,

I made this simple Server Status Checker, that can check the status of websites and IPs... obviously using the simple ping() command... But, I make the script make a new tab in the GUI, and the first time you go to that tab it gets all messed up. But if I go to a different tab then go back, it is fine. Here is the code:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\hdixon\Desktop\Folders\!Stuff\AUTOIT PROGRAMMING\Private Server Status\Koda.kxf
$Form1 = GUICreate("Private Server Status Checker", 436, 261, 234, 145)
$Tab1 = GUICtrlCreateTab(0, 50, 421, 186)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$TabSheet2 = GUICtrlCreateTabItem("Add New Server")
GUICtrlSetState(-1,$GUI_SHOW)
$InputServerName = GUICtrlCreateInput("Type the name of the server here...", 10, 125, 391, 21)
$Label3 = GUICtrlCreateLabel("Add New Server", 15, 80, 161, 37)
GUICtrlSetFont(-1, 16, 400, 0, "Papyrus")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$InputServerIP = GUICtrlCreateInput("Type the IP of the server here..", 10, 150, 391, 21)
$AddServer = GUICtrlCreateButton("Add Server", 15, 180, 381, 36, 0)
GUICtrlCreateTabItem("")
$Label2 = GUICtrlCreateLabel("Private Server Status Checker", 0, 0, 411, 42)
GUICtrlSetFont(-1, 22, 400, 0, "Papyrus")
$Form1context = GUICtrlCreateContextMenu()
$MenuItem1 = GUICtrlCreateMenuItem("Help", $Form1context)
$MenuItem2 = GUICtrlCreateMenuItem("Credits", $Form1context)
$MenuItem3 = GUICtrlCreateMenuItem("PwnCo", $Form1context)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $MenuItem1
    MsgBox(64, "Server Status Checker", "To add another server, go to the Add Server Tab, write in the name and IP address of the server, and then press Add Server.")
Case $MenuItem2
    MsgBox(64, "Server Status Checker", "Scripting: Hok/Snipe/LightByte (gogogadgethd@gmail.com)")
Case $MenuItem3
    MsgBox(64, "Server Status Checker", "PwnCo is at http://pwnco.niceboard.net")
Case $AddServer
    Add()
Case $TabSheet2
    Pinga()
        
        
EndSwitch
WEnd

Func Add()
    $Name=GuiCtrlRead($InputServerName)
    $IP=GuiCtrlRead($InputServerIP)
    $TabSheet1 = GUICtrlCreateTabItem(""&$Name)
    Pinga()
    
EndFunc

Func Pinga()
    $Name=GuiCtrlRead($InputServerName)
    $IP=GuiCtrlRead($InputServerIP)
$PwnPing=ping("" &$IP)
    If $PwnPing>0 then 
        $Label1 = GUICtrlCreateLabel("Status: Online", 5, 130, 406, 97)
        GUICtrlSetFont(-1, 36, 800, 2, "Papyrus")
    Else
        $Label1 = GUICtrlCreateLabel("Status: Offline", 5, 130, 406, 97)
        GUICtrlSetFont(-1, 36, 800, 2, "Papyrus")
    EndIf
EndFunc
Add the close tab item line to Add()

Func Add()
    $Name=GuiCtrlRead($InputServerName)
    $IP=GuiCtrlRead($InputServerIP)
    $TabSheet1 = GUICtrlCreateTabItem(""&$Name)
    GUICtrlCreateTabItem("")
    Pinga()
    
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

×