glarson Posted October 15, 2007 Share Posted October 15, 2007 I would like to write a script that would check to see if EVE online is connected to the internet and detect when the program disconnects. i have seen some posts that use dllcall to check to see if they are connected to the internet. Does anyone know what dll you need to call to monitor EVE's connection? This is the script I found. CODE$state=-1 While 1 If _IsCon()<>$state Then If _IsCon()=0 Then TrayTip("Internet Connection","Disconnected",2,2) $state=0 Else TrayTip("Internet Connection","Connected",2,1) $state=1 EndIf Else EndIf WEnd Func _IsCon() $IsCon=DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0) Return $iscon[0] EndFunc will "InternetCheckConnection" work better then "InternetGetConnectedState"? Link to comment Share on other sites More sharing options...
Uten Posted October 15, 2007 Share Posted October 15, 2007 I don't understand the question.Do you want to:A: Detect if "EVE online" (the server or something) is connected to the Internet?B: Detect if your local client is connected to the server?C: Detect if you have an Internet connection at all? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
murdock Posted October 15, 2007 Share Posted October 15, 2007 That script you found was a little confusing to read so I rewrote it: While _IsCon() TrayTip("Internet Connection","Connected",2,1) Sleep(500) WEnd MsgBox(0, "Internet Connection", "Disconnected") Func _IsCon() Local $inetTest = DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0) Return $inetTest[0] EndFunc Link to comment Share on other sites More sharing options...
glarson Posted October 15, 2007 Author Share Posted October 15, 2007 (edited) I don't understand the question.Do you want to:A: Detect if "EVE online" (the server or something) is connected to the Internet?B: Detect if your local client is connected to the server?C: Detect if you have an Internet connection at all?A: I want to detect if EVE Online is connected to the internet. Edited October 15, 2007 by glarson Link to comment Share on other sites More sharing options...
murdock Posted October 15, 2007 Share Posted October 15, 2007 glarson you can't check if EVE is connected to the internet through your own machines DLLCalls... maybe if you ping the server IP, or if theres a login screen that displays "Offline - Online"? However I think you actually want to know if your client (your computer) is connecting to the server (EVE Online)..? Link to comment Share on other sites More sharing options...
Uten Posted October 15, 2007 Share Posted October 15, 2007 (edited) Use netstat -a and filter against the port your even online client is supposed to use?EDIT: Obviously a ping does not hurt either. But that might not tell you if the game server is online. Edited October 15, 2007 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
glarson Posted October 15, 2007 Author Share Posted October 15, 2007 Use netstat -a and filter against the port your even online client is supposed to use? Uten - I'm not familiar with netsat. what is it? murdock: There is an 'failed connection' screen that comes up when your connection is disabled or lost. your right, what I want to know is if my client is connected to the EVE online server. Can you do that without looking for a screen to appear(lost connection)? I want to do it without mousemovements or pixel searches. Link to comment Share on other sites More sharing options...
wolf9228 Posted October 15, 2007 Share Posted October 15, 2007 #include <Array.au3> #include <Constants.au3> $foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD) $line = StdoutRead($foo) $avArray = StringSplit($line, @LF) _ArrayDisplay($avArray, "_ArrayDisplay() Test") ØµØ±Ø Ø§Ù„Ø³Ù…Ø§Ø¡ كان هنا  Link to comment Share on other sites More sharing options...
glarson Posted October 16, 2007 Author Share Posted October 16, 2007 Thanks wolf9228! Now how would you search for a spacific 'Foreign Address' in the array that is made? I tried this approach but the message box would return nothing! CODE#include <Array.au3> #include <Constants.au3> $foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD) $line = StdoutRead($foo) $avArray = StringSplit($line, @LF) _ArraySort($avArray,0,1) _ArrayDisplay($avArray, "_ArrayDisplay() Sorted") $address=_ArrayBinarySearch($avArray,"TCP Slcnmoodie:1038",0) MsgBox(0,"address",$address) I want to be able to check the 'foreign address' part of the array periodically for a specific address (Eve Online Server). If its not found then I want to call a funcrtion to restart the program. Any ideas? Link to comment Share on other sites More sharing options...
Uten Posted October 16, 2007 Share Posted October 16, 2007 If you start your program from autouit with run you will get the PID. You can use that PID to close/kill the program with ProcessClose. Other vice you culd use ProcessList to get the pid of your client. Close it and start it again with Run. You should probably make sure it is really terminated before you start it again. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 16, 2007 Share Posted October 16, 2007 If you start your program from autouit with run you will get the PID. You can use that PID to close/kill the program with ProcessClose. Other vice you culd use ProcessList to get the pid of your client. Close it and start it again with Run. You should probably make sure it is really terminated before you start it again.Eek... I was going to say something about getting the windows handle from the PID, but that doesn't appear possible. Umm... Hmm. ProcessWait() - wait until process existsProcessExists() - check to see if process exists.ProcessWaitClose() - wait until process exits. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Uten Posted October 16, 2007 Share Posted October 16, 2007 Not a bad suggestion @blue_drache, I'm a bit lazy so I chose the brute force path. Sending a close message to that window will enable the application to close gracefully. You can find the handel of the root window if it does have a window. There are sample code in scripts (if my memory serves me right). But it could have been done by @Larry and therefore gone at the moment. I guess someone have to do a search, if the interest is big enough.. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
wolf9228 Posted October 16, 2007 Share Posted October 16, 2007 Thanks wolf9228! Now how would you search for a spacific 'Foreign Address' in the array that is made? I tried this approach but the message box would return nothing! CODE#include <Array.au3> #include <Constants.au3> $foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD) $line = StdoutRead($foo) $avArray = StringSplit($line, @LF) _ArraySort($avArray,0,1) _ArrayDisplay($avArray, "_ArrayDisplay() Sorted") $address=_ArrayBinarySearch($avArray,"TCP Slcnmoodie:1038",0) MsgBox(0,"address",$address) I want to be able to check the 'foreign address' part of the array periodically for a specific address (Eve Online Server). If its not found then I want to call a funcrtion to restart the program. Any ideas? #include <Constants.au3> $foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD) $line = StdoutRead($foo) if StringInStr($line, "TCP Slcnmoodie:1038") then MsgBox(0, "Search result:", "the StringInStr") ØµØ±Ø Ø§Ù„Ø³Ù…Ø§Ø¡ كان هنا  Link to comment Share on other sites More sharing options...
glarson Posted October 16, 2007 Author Share Posted October 16, 2007 (edited) wolf9228, I coudn't get your script to work. i may not understand what your script is doing, but it wouldn't return the info I was looking for. I want to search the array returned by this line: $foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)for a spacific 'foreign address' to see if I am still connected to the client or not.example from the array:[2]| Proto Local Address Foreign Address State[16]| TCP slcnmoodie:2817 216-129-118-13.cust.layer42.net:http CLOSE_WAITI want to check to see if I am still connected to 216-129-118-13.cust.....ect How can this be done? Edited October 16, 2007 by glarson Link to comment Share on other sites More sharing options...
Kurtferro Posted October 17, 2007 Share Posted October 17, 2007 (edited) I think than glarson want know when the game client got disconnection from the server, its sufficient know if the process (exemple eveonline.exe) have internet activity, dont need with who because game client can be connected only with the game server, if he got dc is sufficien monitoring for few minuts if download and upload activity result be null it mean he got disconnection. but if i understood this code can work because it look if in the netstat list appear the ip, if u arent connected :2817 216-129-118-13.cust.layer42.net:http cant appear in list, because -a option is only for active connection. #include <Constants.au3> $foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD) $line = StdoutRead($foo) if StringInStr($line, "TCP Slcnmoodie:1038") then MsgBox(0, "Search result:", "the StringInStr") Edited October 17, 2007 by Kurtferro Link to comment Share on other sites More sharing options...
glarson Posted October 17, 2007 Author Share Posted October 17, 2007 (edited) I have figured out how to do this. Thanks everyone for the help, you all lead me in the right direction. Here is the code that will create an array with all of your active connections, display it for you, turn the array into a string, then search that string for a specified connection, and tell you if it is there or not. Enjoy all!! CODE#include <Array.au3> #include <Constants.au3> $foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD) $line = StdoutRead($foo) $avArray = StringSplit($line, @LF) _ArraySort($avArray,0,1) _ArrayDisplay($avArray, "_ArrayDisplay() Sorted") $avstring=_ArrayToString($avArray,@LF) if StringInStr($avstring, "Proto Local Address Foreign Address State") then MsgBox(0, "Search result:", "Connection found") Else MsgBox(0,"search results","nope") EndIf Edited October 17, 2007 by glarson Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 17, 2007 Share Posted October 17, 2007 Grats! Welcome to the wonderful world of AutoIt. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
glarson Posted October 17, 2007 Author Share Posted October 17, 2007 Grats! Welcome to the wonderful world of AutoIt.THX Let the good time roll! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now