Sign in to follow this  
Followers 0
SHAHRAM

Internet Connection Status

5 posts in this topic

I have made a script that when given the username and password will connect to ADSL PPOE Internet (using rasdial command) and after checking the connection with ping, it will move to the tray with some options such as Disconnect in the context menu of the tray Icon,

But I need to pull the status of this connection, so if it is disconnected, the icon in the tray would change.

and I don't want to use a ping command in a Loop that would use some bandwidth.

and to make things even worse, I am using GUIoneventMode 1, and the end loop sleeps for hours... (this is to work efficiently in systems with low memory and CPU speed)

Share this post


Link to post
Share on other sites



I have made a script that when given the username and password will connect to ADSL PPOE Internet (using rasdial command) and after checking the connection with ping, it will move to the tray with some options such as Disconnect in the context menu of the tray Icon,

But I need to pull the status of this connection, so if it is disconnected, the icon in the tray would change.

and I don't want to use a ping command in a Loop that would use some bandwidth.

and to make things even worse, I am using GUIoneventMode 1, and the end loop sleeps for hours... (this is to work efficiently in systems with low memory and CPU speed)

You could still use Ping at intervals that will not overload your CPU using AdlibEnable().

Otherwise, I still suggest using AdlibEnable() but you could check out:

InternetGetConnectedState

Or

InternetCheckConnection

Using the Wininet.dll


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

You could still use Ping at intervals that will not overload your CPU using AdlibEnable().

Otherwise, I still suggest using AdlibEnable() but you could check out:

InternetGetConnectedState

Or

InternetCheckConnection

Using the Wininet.dll

Thanx for your response

I guess I could deal with AdlibEnable(), but now the ping function behaves abnormally in getting the connection status and ends prematurely after some time, I guess there will be a slight time out (4sec ?)which results in error being returned .

I have a 2MB ADSL connection, I can imagin how it would be for slower connection, or if having a full speed download

=============

AdlibEnable("CheckCon")

Func CheckCon()

Ping("www.google.com")

If @error = 0 Then

TraySetToolTip("Connected")

Else

TraySetIcon("Shell32.dll",10)

TrayTip ( "Disconnected", "You have been disconnected.", 10 , 1)

TraySetToolTip("Not Connected")

sleep(1000)

Exit

EndIf

EndFunc

while .....

=============

Using the Wininet.dll,

well, I have not been into how to use .dll API inside AutoIt,

I will see what I can do.

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