Jump to content

Recommended Posts

Posted

hello everyone!! :P first i would like to say that autoit is a great programing lang...

i just started (well actualy i wa googleing for a php to exe converter when i bumped to autoit)

so i'm woundering if some1 can help me out with a simple status checker :)

i wanted to make a script that opens a gui win showing xServer1: Online|Offline and xServer2: Online|Offline

but i failed miserably xD

so can some1 help me out ^^

Posted

hello everyone!! :P first i would like to say that autoit is a great programing lang...

i just started (well actualy i wa googleing for a php to exe converter when i bumped to autoit)

so i'm woundering if some1 can help me out with a simple status checker :)

i wanted to make a script that opens a gui win showing xServer1: Online|Offline and xServer2: Online|Offline

but i failed miserably xD

so can some1 help me out ^^

Post your code so we can see where you went wrong, and point you in the right direction to understanding it better. 2 Weeks ago everyone's questions seemed very complex and confusing compared to mine, but the more I mess up and post my code, the more I learn as to why, and what better way would be to go about my problem.

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Posted

Anonymouse spoke well :)

Commands whose helpfile examples you might want to check out:

GuiCreate()

GuiCtrlCreateLabel()

GuiCtrlSetData()

GuiSetState()

Ping()

If ... Then

Combine all those and you should be able to make your script, and more...

Post attempts + errors if you encounter trouble.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Posted

never mind xD i fixed the code :)

here it is:

#include <GUIConstants.au3>
TCPShutdown()
TCPStartup()
Dim $Server1 = IniRead("config.ini","IP","login","null")
Dim $Server2 = iniRead("config.ini","IP","game","null")
Dim $PORT1 = "2106"
Dim $PORT2 = "7777"
Dim $S1P1ACK = ""
Dim $S1P2ACK = ""
Dim $IPADRESS1 = TCPNameToIP($Server1)
Dim $IPADRESS2 = TCPNameToIP($Server2)
Dim $ConnectedSocket1 = 0
$ConnectedSocket1 = TCPConnect($IPADRESS2, $PORT2)
    If @error Then
        $S2P2ACK = "Offline"
    Else
        $S2P2ACK = "Online"
    EndIf
    $ConnectedSocket1 = TCPConnect($IPADRESS1, $PORT1)
    If @error Then
        $S1P1ACK = "Offline"
    Else
        $S1P1ACK = "Online"
    EndIf
    $ConnectedSocket1 = TCPConnect($IPADRESS1, $PORT2)
    If @error Then
        $S1P2ACK = "Offline"
    Else
        $S1P2ACK = "Online"
    EndIf
    GUICreate("Status Checker v0.1",110,50)

GUICtrlCreateLabel("LoginServer: " & $S1P1ACK ,3,3)
GUICtrlCreateLabel("GameServer: " & $S1P2ACK ,3,20)
GUICtrlCreateLabel("by Ombladon",45,35)
TCPShutdown()
GUISetState(@SW_SHOW)
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case Else
            ;;;
        EndSelect
    WEnd
    Exit
Posted

ok i made my sts checker but i got a problem ....

TraySetState (2)
#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=sss.ico
#AutoIt3Wrapper_Res_Description=Lineage ][ Status Checker
#AutoIt3Wrapper_Res_Fileversion=0.1
#AutoIt3Wrapper_Res_LegalCopyright=Copyright Ombladon1991
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
TCPShutdown()
TCPStartup()
Dim $Server1 = IniRead("config.ini","IP","login","null")
Dim $Server2 = iniRead("config.ini","IP","game","null")
Dim $PORT1 = "2106"
Dim $PORT2 = "7777"
Dim $S1P1ACK = ""
Dim $S1P2ACK = ""
Dim $IPADRESS1 = TCPNameToIP($Server1)
Dim $IPADRESS2 = TCPNameToIP($Server2)
Dim $ConnectedSocket1 = 0
    $ConnectedSocket1 = TCPConnect($IPADRESS1, $PORT1)
    If @error Then
    ;MsgBox(16,"Error"," Login Server is Offline")
        $S1P1ACK = "Offline"
        GUICtrlSetColor(-1, 0xff0000)
    Else
        $S1P1ACK = "Online"
        GUICtrlSetColor(-1, 0x00FF00)
        
    EndIf
    $ConnectedSocket1 = TCPConnect($IPADRESS2, $PORT2)
    If @error Then
    ;MsgBox(16,"Error"," Game Server is Offline")
        $S1P2ACK = "Offline"
        GUICtrlSetColor(-1, 0xff0000)
    Else
        $S1P2ACK = "Online"
    EndIf
    GUICreate("Status Checker v0.1",635,75)
    GUISetBkColor ("gray")
GuiCtrlCreatePic("logo.gif",0,0,635,75)
GUICtrlCreateLabel("LoginServer: ",3,55)
GUICtrlSetColor(-1, "0xff0000")
GUICtrlCreateLabel($S1P1ACK ,65,55)

GUICtrlCreateLabel("GameServer: " & $S1P2ACK ,100,55)
GUICtrlSetColor(-1, 0x00FFFF)
GUICtrlCreateLabel("by Ombladon",570,55)
TCPShutdown()


GUISetState(@SW_SHOW)
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case Else
            ;;;
        EndSelect
    WEnd
    Exit

i cant get it to show red color if server is offline and green color when sv is online can some1 help me out xD?

Posted (edited)

Try

GUISetBkColor(0xCCCC00);for green and
GUISetBkColor(0xFF0000); for redoÝ÷ Øw«{lÊ«Âäx,r¸©µ«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì()QÉåMÑMÑÑ È¤()¥´ÀÌØíMÉÙÈÄô%¹¥I ÅÕ½Ðí½¹¥¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí%@ÅÕ½Ðì°ÅÕ½Ðí±½¥¸ÅÕ½Ðì°ÅÕ½Ðí¹Õ±°ÅÕ½Ðì¤)¥´ÀÌØíMÉÙÈÈô%¹¥I ÅÕ½Ðí½¹¥¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí%@ÅÕ½Ðì°ÅÕ½ÐíµÅÕ½Ðì°ÅÕ½Ðí¹Õ±°ÅÕ½Ðì¤)¥´ÀÌØíA=IPÄôÅÕ½ÐìÈÄÀØÅÕ½Ðì)¥´ÀÌØíA=IPÈôÅÕ½ÐìÜÜÜÜÅÕ½Ðì)¥´ÀÌØíLÅ@Å
,ôÅÕ½ÐìÅÕ½Ðì)¥´ÀÌØíLÅ@É
,ôÅÕ½ÐìÅÕ½Ðì)¥´ÀÌØí%AIMLÄôQ
A9µQ½%@ ÀÌØíMÉÙÈĤ)¥´ÀÌØí%AIMLÈôQ
A9µQ½%@ ÀÌØíMÉÙÈȤ)¥´ÀÌØí
½¹¹ÑM½­ÐÄôQ
A
½¹¹Ð ÀÌØí%AIMLİÀÌØíA=IPĤ()Q
AM¡Õѽݸ ¤)Q
AMÑÉÑÕÀ ¤()U%
ÉÑ ÅÕ½ÐíMÑÑÕÌ
¡­ÈØÀ¸ÄÅÕ½Ðì°ØÌÔ°ÜÔ¤)U%MÑ  ­
½±½È ÅÕ½ÐíÉäÅÕ½Ðì¤)U%
Ñɱ
ÉÑA¥ ÅÕ½Ðí±½¼¹¥ÅÕ½Ðì°À°À°ØÌÔ°ÜÔ¤)U%
Ñɱ
ÉÑ1° ÅÕ½Ðí1½¥¹MÉÙÈèÅÕ½Ðì°Ì°ÔÔ¤)U%
ÑɱMÑ
½±½È ´Ä°ÅÕ½ÐìÁáÀÀÀÀÅÕ½Ðì¤)U%
Ñɱ
ÉÑ1° ÀÌØíLÅ@Å
,°ØÔ°ÔÔ¤)U%
Ñɱ
ÉÑ1° ÅÕ½ÐíµMÉÙÈèÅÕ½ÐìµÀìÀÌØíLÅ@É
,°ÄÀÀ°ÔÔ¤)U%
ÑɱMÑ
½±½È ´Ä°ÁàÀÁ¤)U%
Ñɱ
ÉÑ1° ÅÕ½Ðíä=µ±½¸ÅÕ½Ðì°ÔÜÀ°ÔÔ¤((ÀÌØí
½¹¹ÑM½­ÐÄôQ
A
½¹¹Ð ÀÌØí%AIMLİÀÌØíA=IPĤ)%ÉɽÈQ¡¸($ÀÌØíLÅ@Å
,ôÅÕ½Ðí=±¥¹ÅÕ½Ðì(%U%MÑ   ­
½±½È ÁáÀÀÀÀ¤)±Í($ÀÌØíLÅ@Å
,ôÅÕ½Ðí=¹±¥¹ÅÕ½Ðì(%U%MÑ ­
½±½È Áá


ÀÀ¤()¹%(ÀÌØí
½¹¹ÑM½­ÐÄôQ
A
½¹¹Ð ÀÌØí%AIMLȰÀÌØíA=IPȤ)%ÉɽÈQ¡¸(($ÀÌØíLÅ@É
,ôÅÕ½Ðí=±¥¹ÅÕ½Ðì(%U%MÑ   ­
½±½È ÁáÀÀÀÀ¤)±Í($ÀÌØíLÅ@É
,ôÅÕ½Ðí=¹±¥¹ÅÕ½Ðì)¹%()Q
AM¡Õѽݸ ¤()U%MÑMÑÑ¡M]}M!=¤)]¡¥±Ä($ÀÌØíµÍôU%Ñ5Í ¤(%M±Ð($%
ÍÀÌØíµÍôÀÌØíU%}Y9Q}
1=M($$%á¥Ñ1½½À($%
ͱÍ($$$ììì(%¹M±Ð)]¹)á¥Ð()Q
AM¡Õѽݸ ¤

It's important to use a proper format. In your case this was the problem: You've created the GUI at the far end. The format is about the order of the lines in your script. Here it is:

1. Place required include files.

2. Set Autoit options, as needed.

3. Declare Variables.

4. Set Desired Hot Keys.

5. Create the GUI.

6. Display the GUI.

7. Set/Update control information.

8. Set the Tray Menu

9. Start the Loop, and "Listen" for a message.

10. Create the Functions.

Try Valuater's AutoIt 1-2-3 :)

Edited by Kiti
Posted (edited)

it gives me red background and does not show online or offline at all :)

#include <GUIConstants.au3>

TraySetState(2)

Dim $Server1 = IniRead("config.ini", "IP", "login", "null")
Dim $Server2 = IniRead("config.ini", "IP", "game", "null")
Dim $PORT1 = "2106"
Dim $PORT2 = "7777"
Dim $S1P1ACK = ""
Dim $S1P2ACK = ""
Dim $IPADRESS1 = ""
Dim $IPADRESS2 = ""
Dim $ConnectedSocket1 = TCPConnect($IPADRESS1, $PORT1)

TCPShutdown()
TCPStartup()

GUICreate("Status Checker v0.1", 635, 75)
GUISetBkColor("gray")
GUICtrlCreatePic("logo.gif", 0, 0, 635, 75)
GUICtrlCreateLabel("LoginServer: ", 10, 55)
GUICtrlSetColor(-1, "0x00FFFF")
GUICtrlCreateLabel($S1P1ACK, 65, 55)
GUICtrlCreateLabel("GameServer: " , 130, 55)
GUICtrlSetColor(-1, 0x00FFFF)
GUICtrlCreateLabel("by Ombladon", 570, 55)

$ConnectedSocket1 = TCPConnect($IPADRESS1, $PORT1)
If @error Then
    $S1P1ACK = "Offline"
    GUISetBkColor(0xFF0000)
    GUICtrlCreateLabel("Offline", 80,55)
GUICtrlSetColor(-1, 0x00FFFF)
Else
    $S1P1ACK = "Online"
    GUISetBkColor(0xCCCC00)
    GUICtrlCreateLabel("Online", 80,55)
GUICtrlSetColor(-1, 0x00FFFF)

EndIf
$ConnectedSocket1 = TCPConnect($IPADRESS2, $PORT2)
If @error Then

    $S1P2ACK = "Offline"
    GUISetBkColor(0xFF0000)
    GUICtrlCreateLabel("Offline", 200,55)
GUICtrlSetColor(-1, 0x00FFFF)
Else
    $S1P2ACK = "Online"
    GUISetBkColor(0xCCCC00)
        GUICtrlCreateLabel("Online", 200,55)
GUICtrlSetColor(-1, 0x00FFFF)
EndIf

TCPShutdown()

GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
            ;;;
    EndSelect
WEnd
Exit

TCPShutdown()

That's because the GUI is before the server check.

Edited by Kiti
Posted

thx.... your ideea helped me fix it xD

TraySetState (2)
#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=sss.ico
#AutoIt3Wrapper_Res_Description=Lineage ][ Status Checker
#AutoIt3Wrapper_Res_Fileversion=0.1
#AutoIt3Wrapper_Res_LegalCopyright=Copyright Ombladon1991
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>

TCPShutdown()
TCPStartup()
Dim $Server1 = "74.86.194.219"
Dim $Server2 = "74.86.194.219"
Dim $PORT1 = "2106"
Dim $PORT2 = "7777"
Dim $S1P1ACK = ""
Dim $S1P2ACK = ""
Dim $IPADRESS1 = TCPNameToIP($Server1)
Dim $IPADRESS2 = TCPNameToIP($Server2)
Dim $ConnectedSocket1 = 0
GUICreate("Status Checker v0.1",560,75)
GUISetBkColor ("gray")
    $ConnectedSocket1 = TCPConnect($IPADRESS1, $PORT1)
    If @error Then
        MsgBox(16,"Error"," Login Server is Offline")
        $S1P1ACK = "Offline"
        GUICtrlCreateLabel($S1P1ACK ,71,55)
        GUICtrlSetColor(-1, 0xFF0000)
    Else
        $S1P1ACK = "Online"

        GUICtrlCreateLabel($S1P1ACK ,71,55)
        GUICtrlSetColor(-1, 0x00FF00)
    EndIf
    $ConnectedSocket1 = TCPConnect($IPADRESS2, $PORT2)
    If @error Then
        MsgBox(16,"Error"," Game Server is Offline")
        $S1P2ACK = "Offline"
        GUICtrlCreateLabel($S1P2ACK ,181,55)
        GUICtrlSetColor(-1, 0xFF0000)
    Else
        $S1P2ACK = "Online"
        GUICtrlCreateLabel($S1P2ACK ,181,55)
        GUICtrlSetColor(-1, 0x00FF00)
    EndIf

TCPShutdown()


GuiCtrlCreatePic("logo.gif",0,0,635,75)
GUICtrlCreateLabel("LoginServer:",3,55)
GUICtrlSetColor(-1, 0x00FFFF)

GUICtrlCreateLabel("GameServer:",111,55)
GUICtrlSetColor(-1, 0x00FFFF)

GUISetState(@SW_SHOW)
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
            MsgBox(64,"L2Refused - Status Checker","Thanks For using this Status Checker" & Chr(13) & Chr(10) & "Love Ombladon")
                ExitLoop
            Case Else
            ;;;
        EndSelect
    WEnd
    Exit

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
×
×
  • Create New...