 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
al Guest
|
Posted: Fri Jul 23, 2004 3:22 pm Post subject: checking internet connection |
|
|
Hi
Thank you for this great prog. I want to run a script which checks my internet connection say every 15 mins. If im not connected it reboots.
| Code: |
Loop
{
FileDelete, C:\WINDOWS\Temporary Internet Files\google.htm
sleep, 2000
FileDelete, C:\google.htm
sleep, 2000
URLDownloadToFile, http://www.google.com, C:\google.htm
sleep, 2000
IfExist, C:\google.htm
{
sleep, 900000 ;15 mins
}
Else
{
Shutdown, 6 ;reboot
}
}
return
|
but this line | Code: | | FileDelete, C:\WINDOWS\Temporary Internet Files\google.htm | is not deleting the file.
Any ideas?
Thanks |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Fri Jul 23, 2004 5:27 pm Post subject: |
|
|
A workaround ...
tempfile = C:\WINDOWS\Temporary Internet Files\google.htm
Run, %comspec% /c del "%tempfile%",, Hide
(I have some issues with FileMove ) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Fri Jul 23, 2004 5:29 pm Post subject: |
|
|
You probably shouldn't delete files directly from the cache. Maybe the delete fails because the OS won't let you.
But the most important thing is that there is a much easier way to check your connection: Use the built-in variables A_IPAddress1 through 4. One of them (probably the 1st or 2nd) should be different (perhaps 0.0.0.0) when you are not connected. This assumes you're using dial-up or a DHCP IP address rather than a hard-coded one. |
|
| Back to top |
|
 |
al Guest
|
Posted: Sat Jul 24, 2004 1:27 am Post subject: |
|
|
thanks for reply guys.
This one works
| Code: |
x=%A_IPAddress1%
sleep, 2000
Loop
{
IfEqual, x, %A_IPAddress1%
{
sleep, 900000
}
Else
{
Shutdown, 6 ;reboot
}
}
return |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|