Sign in to follow this  
Followers 0
Tiger

Script checks the internet connection

5 posts in this topic

I have wrote a script, that runs always. then the internet connection is active then show the trayicon. but the script start and close.

#NoTrayIcon
Opt("TrayIconDebug", 0)
Opt("TrayMenuMode", 1)

AdlibEnable("internet", 500)

Func internet()
    If (Ping("www.google.de", 500) <> 0) And (Ping("www.yahoo.de", 750) <> 0) Then
        ; Show TrayIcon
        Opt("TrayIconHide", 0)
    Else
        ; Hide TrayIcon
        Opt("TrayIconHide", 1)
    EndIf
EndFunc   ;==>_internet

My UDFs:- _RegEnumKey

Share this post


Link to post
Share on other sites



OK thanks. But i would like to stop the function then the internet connection is active an then is not active then i would licke to run the function


My UDFs:- _RegEnumKey

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You need an infinite loop:

#NoTrayIcon
Opt("TrayIconDebug", 0)
Opt("TrayMenuMode", 1)
HotKeySet("{F9}", "ExitModule")
internet()
AdlibEnable("internet", 10000)
Func internet()
    If Ping("www.google.de") Or Ping("www.yahoo.de") Then
        Opt("TrayIconHide", 0)
    Else
        Opt("TrayIconHide", 1)
    EndIf
EndFunc;==>internet
While 1
    Sleep(60)
WEnd
Func ExitModule()
    Exit
EndFunc;==>ExitModule

The above code works on my machine. Once program execution reached the end of the original version, it correctly exited. But with this line in your script:

Opt("TrayMenuMode", 1)

you needed a way to stop the program, and that is why you should have that ExitModule and the HotKeySet.

Edited by Squirrely1

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

Thanks Squirrely1. The script runs very good


My UDFs:- _RegEnumKey

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