AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

detecting internet status

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Sandra
Guest





PostPosted: Mon Jan 15, 2007 6:10 am    Post subject: detecting internet status Reply with quote

Hi Razz , can AHK script detect if generally Windows has a running Internet or is offline? How would you express that in AHK script language? I am working on a stage where it looks to see if internet is there or not in my scripting, so I am at a impass...figuring this call out Smile I hope you see my picture and phase... pls. help!! Smile
Back to top
BoBo
Guest





PostPosted: Mon Jan 15, 2007 9:07 am    Post subject: Reply with quote

Quote:
How would you express that in AHK script language?
Code:
Run, iexplore,, max
Back to top
AngieX



Joined: 26 Nov 2006
Posts: 77

PostPosted: Mon Jan 15, 2007 10:33 am    Post subject: Sandra Reply with quote

BoBo wrote:
Quote:
How would you express that in AHK script language?
Code:
Run, iexplore,, max


Say what ?! Very Happy
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Mon Jan 15, 2007 10:53 am    Post subject: Reply with quote

If the browser starts correctly with the preset template/home, you're online. Razz
Back to top
AngieX



Joined: 26 Nov 2006
Posts: 77

PostPosted: Mon Jan 15, 2007 10:59 am    Post subject: Reply with quote

BoBo wrote:
If the browser starts correctly with the preset template/home, you're online. Razz


Ah I see where you are going. It certainly validates the Internet 'home page' shows you're on the Internet, but I am hoping some way is possible with AHK to return a variable 1=on 2=off approach - can be done Very Happy
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1158
Location: Denmark

PostPosted: Mon Jan 15, 2007 11:08 am    Post subject: Reply with quote

Quote:
IsNetworkAlive

The IsNetworkAlive function determines whether or not a local system is connected to a network, and identifies the type of network connection, for example, a LAN, WAN, or both.


Bool IsNetworkAlive(
LPDWORD lpdwFlags
);

Parameters
lpdwFlags
[out] The type of network connection that is available. This parameter can be one of the following values:

NETWORK_ALIVE_LAN
The computer has one or more LAN cards that are active.
NETWORK_ALIVE_WAN
The computer has one or more active RAS connections.
NETWORK_ALIVE_AOL
This flag is only valid in Windows Me/98/95.
Indicates a computer is connected to the America Online (AOL) network.

Return Values
This function returns one of the following values:Return code Description
TRUE A local system is connected to a network.
For information about the type of connection, see the lpdwFlags parameter.

FALSE There is no connection.
For extended error information, call GetLastError.


Remarks
This function can be used by an application to determine whether or not there is network connectivity before proceeding with network operations. A directory service type of application, e-mail client, or Internet browser can adapt to various types of network connectivity. For example, a printing operation can be deferred until a network connection is available.

It may not always be practical for an application to call IsNetworkAlive to determine whether or not a local system is disconnected from a LAN, because IsNetworkAlive can be slow, and it may take too much time for the function to detect that a local system is disconnected. However, IsNetworkAlive can always identify a WAN connectivity at the moment.

Note This function is only available for TCP/IP connections.


Resides in sensapi.dll
_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
ZeLen1y



Joined: 11 Oct 2006
Posts: 4

PostPosted: Tue Jan 16, 2007 2:59 am    Post subject: Reply with quote

Code:
MsgBox, % DllCall("sensapi.dll\IsNetworkAlive", "UInt *", "NETWORK_ALIVE_LAN")
Back to top
View user's profile Send private message
Seabiscuit



Joined: 07 Jan 2007
Posts: 109
Location: In fund pe scaun, la o bere prin Romania :D

PostPosted: Sat Sep 22, 2007 7:32 am    Post subject: Reply with quote

The code above doesnt works for me.
I have Internet through lan-usb, could be this the problem?
_________________
Backgammon addicted!
GamesGrid was one of the first online web sites to bring Backgammon to the Internet
Back to top
View user's profile Send private message Yahoo Messenger
POINTS



Joined: 18 Jan 2006
Posts: 283

PostPosted: Sat Sep 22, 2007 11:40 pm    Post subject: I have a script Reply with quote

I have a script that runs when I start my computer because sometimes it takes a minute or 2 to get an IP address. This script shows a splash screen until the computer has an IP. (It might not work on all machines.) The script assumes that we have an IP address that doesn't start with 192.168. until we get a valid one that does.

Code:

; Check to see if we have an IP address yet
if (InStr(A_IPAddress1, "192.168." ) != 1) ; if it is not the first position
{
  SplashTextOn,,, Resolving IP Address...
  Loop
  {
    if (InStr(A_IPAddress1, "192.168." ) == 1) ; if it is the first position
      break
    Sleep 100
  }
  SplashTextOff
}
Return

_________________
My AutoHotkey Program for Warcraft III:
Warkeys
http://warkeys.sourceforge.net/

Remap your hotkeys
Healthbars always on
Remap inventory
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 5811

PostPosted: Sun Sep 23, 2007 8:50 am    Post subject: Reply with quote

Seabiscuit wrote:
The code above doesnt works for me.
I have Internet through lan-usb, could be this the problem?


You may try the couple of methods posted here

Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group