Sign in to follow this  
Followers 0
Didonet

Network status on taskbar

27 posts in this topic

is it possible to create a network status on the taskbar? Like in windows.

Example: Posted Image

Share this post


Link to post
Share on other sites



Yes this is possible.

For tray icon see TraySetIcon() in helpfile.and add your network logic.

And how to get my network logic? :)

Share this post


Link to post
Share on other sites

Is it possible to get that "network logic" or somehow to get the status of the network or to forget this way?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

thanks for the script, but how about outgoing traffic and incoming... and when they are connected? Or this is impossible?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Edited by weaponx

Share this post


Link to post
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...

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi :) I think this script didn't log outgoing and incoming traffic... it just says "connected" or not.. :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

How about netshell_191 and netshell_192? Is it possible to stat them?

Or there's no way? And how can i put this resources (netshell_195 and netshell_193) into the .exe?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

No, no... i want a real statistic.. not to wait 1sec and show the next icon :)

Share this post


Link to post
Share on other sites

Then you have to read about

How to capture network traffic with Network Monitor

here


The point of world view

Share this post


Link to post
Share on other sites

OK, i'll use only 2 icons for online or offline... i can't get the way to "capture the traffic with network monitor" :)

And.. can i put the two icons into the exe? As resources?

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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()

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