AutoHotkey Community

It is currently May 24th, 2012, 2:31 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: January 15th, 2007, 6:10 am 
Hi :P , 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 :) I hope you see my picture and phase... pls. help!! :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2007, 9:07 am 
Quote:
How would you express that in AHK script language?
Code:
Run, iexplore,, max


Report this post
Top
  
Reply with quote  
 Post subject: Sandra
PostPosted: January 15th, 2007, 10:33 am 
Offline

Joined: November 26th, 2006, 8:10 pm
Posts: 77
BoBo wrote:
Quote:
How would you express that in AHK script language?
Code:
Run, iexplore,, max


Say what ?! :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2007, 10:53 am 
If the browser starts correctly with the preset template/home, you're online. :P


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2007, 10:59 am 
Offline

Joined: November 26th, 2006, 8:10 pm
Posts: 77
BoBo wrote:
If the browser starts correctly with the preset template/home, you're online. :P


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 :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2007, 11:08 am 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
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

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2007, 2:59 am 
Offline

Joined: October 11th, 2006, 5:27 am
Posts: 27
Code:
MsgBox, % DllCall("sensapi.dll\IsNetworkAlive", "UInt *", "NETWORK_ALIVE_LAN")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2007, 7:32 am 
Offline

Joined: January 7th, 2007, 6:40 pm
Posts: 109
Location: In fund pe scaun, la o bere prin Romania :D
The code above doesnt works for me.
I have Internet through lan-usb, could be this the problem?

_________________
ImageBackgammon addicted!
GamesGrid was one of the first online web sites to bring Backgammon to the Internet


Report this post
Top
 Profile  
Reply with quote  
 Post subject: I have a script
PostPosted: September 22nd, 2007, 11:40 pm 
Offline

Joined: January 18th, 2006, 12:37 am
Posts: 290
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2007, 8:50 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
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

:)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: azure, BrandonHotkey, Cerberus, engunneer, Pulover, Sambo and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group