Jump to content

Network status on taskbar


Didonet
 Share

Recommended Posts

HI,

Func isOnline()
    If Ping("www.google.de") > 0 Then
        MsgBox(64, "Internet connection active!", "You internet connection is enabled...")
    Else
        MsgBox(16, "Internet connection failure!", "You internet connection is disabled...")
    EndIf
EndFunc   ;==>isOnline

Func _checkINet()
    $IsCon = DllCall("WinInet.dll", "int", "InternetGetConnectedState", "int_ptr", 0, "int", 0)
    If $IsCon[0] = 0 Then
        MsgBox(0, "NO CONNECTION", "Please Connect To The Internet Before Continuing")
    Else
        MsgBox(0, "CONNECTION", "Online")
    EndIf
EndFunc   ;==>_checkINet

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Why aren't you just showing the local area connection icon on the taskbar?

because i write a program to connect to the i-net.

my i-net provider use a web page to submit user/pass and then to start the internet. if i do not login i don't have i-net :)

I want to create a program to get the status of the network...

Link to comment
Share on other sites

Hi,

what info do you miss?

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

If you need the icon in the taskbar to reflect network activity you need to use Windows builtin tray icon.

Right Click My Network Places > Click Properties

Right Click Local Area Connection > Click Properties

Check the box labeled > Show icon in notification area when connected

Click OK

Any other way would be silly.

If you only need to show an icon reflecting the "Network Status" and you don't want to use the above method you can try this:

#Include 
TraySetState()
$dropped = true

While 1
    isOnline()
    Sleep(1000)
WEnd
Func isOnline()
    If Ping("www.google.com") > 0 Then
        TraySetIcon ("netshell_193.ico")
        If $dropped Then 
            TrayTip ( "", "Connection established", 4, 1)
            $dropped = False
        EndIf
    Else
        TrayTip ( "Warning", "Connection lost", 4, 2)
        TraySetIcon ("netshell_195.ico")
        $dropped = true
    EndIf

Required icons:

netshell_195.ico

netshell_193.ico

Link to comment
Share on other sites

Try it

#Include <Constants.au3>
#NoTrayIcon
Global $Start, $FromTo
Global $YourURL = 'www.ya.ru'

Opt("TrayMenuMode",1)  ; Default tray menu items (Script Paused/Exit) will not be shown.

$Exit = TrayCreateItem("Exit")
TraySetState()
$Start = TimerInit()
While 1
    $msg = TrayGetMsg()
    If $msg = $Exit Then ExitLoop
    If TimerDiff($Start) > 1000 Then IsOn()
WEnd
Exit

func IsOn()
 If Ping($YourURL) > 0 then
   TraySetIcon ("netshell.dll", 59)
   Sleep(1000)
   TraySetIcon ("netshell.dll", 60)
   Sleep(1000)
   TraySetIcon ("netshell.dll", 61)
 else
  TraySetIcon ("netshell.dll", 62)
 endif
 $Start = TimerInit()
endfunc

I prefer use

$YourURL = 'www.ya.ru'

but you can set your favorite one.

The point of world view

Link to comment
Share on other sites

I've been trying to do a few things with resources myself and I don't think autoit supports them. Try using FileInstall, it should work just as well if you put the icons in the temp dir.

Link to comment
Share on other sites

You will need to download and install SciTe. After you install SciTe open the help file scroll down to Extra Utilities and look for AutoIt3Wrapper. That will give you all the information you need to add icons to the EXE.

;Add extra ICO files to the resources which can be used with TraySetIcon(@ScriptFullPath, 3) etc

; list of filename of the Ico files to be added, First one will have number 3, then 4 ..etc

#AutoIt3Wrapper_Res_Icon_Add= ; Filename of ICO to be added.

#AutoIt3Wrapper_Res_Icon_Add= ; Filename of ICO to be added.

#AutoIt3Wrapper_Res_File_Add= ; Filename[,Section [,ResName]] to be added.

#AutoIt3Wrapper_Res_File_Add= ; Filename[,Section [,ResName]] to be added.

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Thanks, but... i cannot get the resources. i put the reshack.exe to the AutoIt3Wrapper subdirectory and i compile.. in reshack the resources are there, but if i cannot get them with this script

#AutoIt3Wrapper_Res_Icon_Add=netshell_193.ico
#AutoIt3Wrapper_Res_Icon_Add=netshell_195.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype2.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype3.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype-blank.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****





#include <GUIConstants.au3>

GUICreate("Demo resource ICO's")

$h_Button1 = GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)

GUISetState()

For $x = 1 To 8

   $rc = TraySetIcon(@ScriptFullPath, $x)

   $rc2 = GUICtrlSetImage($h_Button1, @ScriptFullPath, $x)

   If $x < 3 Then

      TrayTip("Default ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)

   Else

      TrayTip("New ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)

   EndIf

   Sleep(2000)

Next

GUIDelete()
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...