AutoHotkey Community

It is currently May 27th, 2012, 10:26 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: February 10th, 2005, 10:11 am 
hello,
I'm new to auto hot key scripting and I like it so much. :)

I'd like to know if there is a way to write a script that can detect if the PC is connected to the internet or not and alert the user with the result?
some other thing I'd like to know could a script force an internet connection!? and Is there a way to prevent that?

If anyone can help with that, thanks a million! :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2005, 10:26 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
AFAIK forcing a connection is not silently possible...

for detecting it, this is what i use:

Code:
Menu, Tray, Icon, E:\stuff\Pics\icons\GeoIcons\Smiley-Apathetic.ico

Loop
{
   FileDelete, %temp%\PingResult.txt
   RunWait, cmd /c ping  66.102.11.104 -n 1 >%temp%\PingResult.txt,, hide
   FileRead, PingResult, %temp%\PingResult.txt

   IfInString, PingResult, Reply from
      Menu, Tray, Icon, E:\stuff\Pics\icons\GeoIcons\Smiley.ico
   Else
      Menu, Tray, Icon, E:\stuff\Pics\icons\GeoIcons\Smiley-Sad.ico
   
   Sleep, 5000
}


want the icons?

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2005, 10:37 am 
Offline

Joined: January 31st, 2005, 4:11 pm
Posts: 65
Thats cool I want them :D :D :D :D :D :D :D
whoooooohoooooo!

_________________
Image
Th!s !s STYLE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2005, 11:46 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
here

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2005, 11:32 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Another way to detect an Internet connection (on some systems) is to check the contents of the built-in variables A_IPAddress1 through 4.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 10:31 am 
.. Thank you Rajat .. I already tried the ping commend once but I wasn't sure how to make the script get the replay! .. now I do .. :) thanks again!

.. Thank you Chris .. I think using the IPaddress is just what I was looking for.. it works so good .. thanks!

Still the other thing about forcing the connection .. I know for sure that some software could do that, but I was trying to do it using AHK script,
you can say..I like home cook! :D

can anyone help with that. or maybe I should give up? :?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 10:33 am 
ooops ..
New_G = Guest_G .. hu!
just in case u didn't notice that! :lol:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 10:38 am 
Once you've detected an active connection, there's no need to force another one. A "force" btw. indicates that this new connection should be established against the will of the user who has started the current one ! :shock: :? 019x ...

Check your OS' rasdial command.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 11:28 am 
Hi BoBo ..
thank you for the fast reply..
Here's what I'm trying to do,
Because sometimes I 've to use a poor "dial up" connection to the internet. I face some troubles dowenloading large size files.
beside it's slow,Sometimes it may disconnected.
It's still an idea but I'm trying to colect what I need to write a script that would check the connection over an interval timer and check the size of the file that's currently downloaded ( that would be given as input or to be detected from the download dialogbox ).
so, if the size of the temp file used for the download doesn't reach the right size AND the script cann't detect a connection. then we need the script to FORCE a new connection and delete the temp and start a new download process.!

well .. that was the idea .. does it goes too far .. maybe.!

thanks once again. and still waiting for help .. I didn't give up yet. :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 12:01 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
if you use dialup then IPAddress vars will do the trick for you..(i thought its just me who's been stuck with dialup for so long)... what i suggested was for usage on static IP system (works on dialup too though)...

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 12:21 pm 
Quote:
then we need the script to FORCE a new connection and delete the temp and start a new download process
Check --> wGet as it (AFAIK) allows to resume a collapsed download. It doesn't make sense to start a 1GB download from scratch (which costs money, and in case you don't know "time is money" - you don't believe it ? Hire Jonny and check how it feels to get bancrupt :lol: (just kidding J. :P ) if the last few bytes are missing as a result of a disconnection.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 7:32 pm 
I want an alert sound file to be triggered off whenever the high speed internet connection icon is disappeared (Line get disconnected) from the tray. The Window Title for the connection icon by right clicking on the connection icon using window spy is Connection Tray. How to detect its existence in tray in the script? Using 'IfWinNotExist Connection Tray' wont work.

Thanks.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 7:43 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
info10020 wrote:
I want an alert sound file to be triggered off whenever the high speed internet connection icon is disappeared (Line get disconnected) from the tray.


any specific reason you can't use a modded ver of my script above for that?...it'd just take 'SoundPlay' instead of 'Menu, Tray, Icon'!!

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 10:13 pm 
Rajat,

I replaced Menu, Tray, Icon with 'MsgBox Connected' and 'MsgBox Disconnected' in your above script but same msg i.e. only Connected showed when I manually disconnected the internet line. That's why I thought of the idea of detecting the connection icon in the tray. I have tried the %A_IPAdress1% also but no luck.

Thanks.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2005, 4:56 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
Quote:
I want an alert sound file to be triggered off whenever the high speed internet connection icon is disappeared

ImageSearch :!:

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, robotkoer, specter333 and 69 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