[REQ] Show icon in notification area when connected
#1
Posted 20 January 2007 - 08:28 AM
#2
Posted 21 January 2007 - 09:30 PM
can add to your runoncex to execute it. Works for me
LANIconShow.cmd
REM @ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
FOR /F "TOKENS=1 DELIMS= " %%A IN ('REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}') DO (
SET TEMP1=%%A
SET TEMP2=!TEMP1:~99,38!
SET TEMP3=!TEMP2:~-1!
IF "!TEMP3!"=="}" (
IF NOT "!TEMP2!"=="{4D36E972-E325-11CE-BFC1-08002BE10318}" (
SET REGSTR1=HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\!TEMP2!\Connection
SET REGSTR2=HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\!TEMP2!
REG ADD !REGSTR1! /v ShowIcon /t REG_DWORD /d 1 /f
REG ADD !REGSTR2! /v IPAutoconfigurationEnabled /t REG_DWORD /d 0 /f
)
)
)
EXIT
#4
Posted 20 June 2007 - 02:01 PM
Here's a single line batch file solution
@FOR /F "DELIMS=" %%? IN ('REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} /S^|FINDSTR \\Connection$') DO @REG ADD "%%?" /V ShowIcon /T REG_DWORD /D 1 /F>NUL
#5
Posted 20 June 2007 - 02:22 PM
On Error Resume Next
set ws = WScript.CreateObject("WScript.Shell")
start = "HKLM\SYSTEM\CurrentControlSet"
'classGUID = GUID for all Network Connection Class
classGUID = ws.RegRead(start & "\Enum\Root\MS_NDISWANIP000\ClassGUID")
'netIDxx = UID for each member of the Network Connection Class containing specific network adapters
netID01 = ws.RegRead(start & "\Control\Class\" & classGUID & "001\NetCfgInstanceID")
netID02 = ws.RegRead(start & "\Control\Class\" & classGUID & "002\NetCfgInstanceID")
netID03 = ws.RegRead(start & "\Control\Class\" & classGUID & "003\NetCfgInstanceID")
netID04 = ws.RegRead(start & "\Control\Class\" & classGUID & "004\NetCfgInstanceID")
netID05 = ws.RegRead(start & "\Control\Class\" & classGUID & "005\NetCfgInstanceID")
netID06 = ws.RegRead(start & "\Control\Class\" & classGUID & "006\NetCfgInstanceID")
netID07 = ws.RegRead(start & "\Control\Class\" & classGUID & "007\NetCfgInstanceID")
netID08 = ws.RegRead(start & "\Control\Class\" & classGUID & "008\NetCfgInstanceID")
netID09 = ws.RegRead(start & "\Control\Class\" & classGUID & "009\NetCfgInstanceID")
netID10 = ws.RegRead(start & "\Control\Class\" & classGUID & "010\NetCfgInstanceID")
netID11 = ws.RegRead(start & "\Control\Class\" & classGUID & "011\NetCfgInstanceID")
netID12 = ws.RegRead(start & "\Control\Class\" & classGUID & "012\NetCfgInstanceID")
netID13 = ws.RegRead(start & "\Control\Class\" & classGUID & "013\NetCfgInstanceID")
netID14 = ws.RegRead(start & "\Control\Class\" & classGUID & "014\NetCfgInstanceID")
' setIcon recieves location of current network connections and also flag (1) to turn on showIcons
setIcon start & "\Control\Network\" & classGUID & "\" & netID01 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID02 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID03 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID04 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID05 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID06 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID07 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID08 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID09 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID10 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID11 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID12 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID13 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID14 & "\Connection\", 1
'MsgBox "Show icon in Notification Area when connected is set.", 4096,"Finished"
'********************************************************
' Subroutine setIcon(nicID as String, flag as Binary)
' strName = Registry Value of "Name" in Current nicID. Network connections with Icons also contain a "Name" Registry setting
' Will not effect 1394 Connection through string comparison with strName
' flag is used to turn to set ShowIcon registry setting
Sub setIcon(nicID,flag)
strName = ws.RegRead( nicID & "Name")
If strName = "" Then
else
if InStr(strName, "1394") = 0 then
' MsgBox strName
ws.RegWrite nicID & "ShowIcon", flag, "REG_DWORD"
end if
end if
End Sub
This post has been edited by war59312: 20 June 2007 - 02:23 PM
#6
Posted 20 June 2007 - 03:01 PM
Thank you so much for the Batch file ,This worked like a charm.
Perfect
#7
Posted 26 October 2008 - 03:46 PM
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.1
Language: English
Platform: Windows XP
Author: artbio
Script Function:
Show icon in notification area when connected.
#ce ----------------------------------------------------------------------------
#NoTrayIcon
#include <Misc.au3>
_Singleton("Network Icon AutoIt v3 Script 1.0", 0); It's already running
Dim Const $sKey = "HKLM\SYSTEM\CurrentControlSet\Control\Network"
Dim $k
While 1
$k += 1
$sSubKey0 = RegEnumKey($sKey, $k)
If @error Then ExitLoop
$sDefault = RegRead($sKey & "\" & $sSubKey0, "")
$sClass = RegRead($sKey & "\" & $sSubKey0, "Class")
If $sDefault = "Network Adapters" And $sClass = "Net" Then ExitLoop
WEnd
$k = 0
While 1
$k += 1
$sSubKey1 = RegEnumKey($sKey & "\" & $sSubKey0, $k)
If @error Then ExitLoop
If RegRead($sKey & "\" & $sSubKey0 & "\" & $sSubKey1 & "\Connection", "Name") = "Local Area Connection" Then ExitLoop
WEnd
If Not @error Then RegWrite($sKey & "\" & $sSubKey0 & "\" & $sSubKey1 & "\Connection", "ShowIcon", "REG_DWORD", 1)
Exit
Regards.
#8
Posted 26 October 2008 - 06:23 PM
#include-once
; #FUNCTION# ====================================================================================================
================
;
; Name...........: _Network_SetIcon
; Description ...: Shows or hides the network icon in notification area when connected.
; Syntax.........: _Network_SetIcon($sNetConnectionID [, $iFlag, $sComputerName])
; Parameters ....: $sNetConnectionID - Name of the network connection.
; $iFlag - [Optional] A flag indicating the behaviour of the network icon:
; 0 - Icon in notification area when connected remains hidden.
; 1 - Icon in notification area when connected is shown.
; Default is "1".
; $sComputerName - [Optional] Computer name.
; The local computer is default.
; Return values .: Success - Returns 1
; Failure - Returns 0 and sets @error:
; Author ........: artbio
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ====================================================================================================
===========================
Func _Network_SetIcon($sNetConnectionID, $iFlag = 1, $sComputerName = @ComputerName)
Local Const $sKey = "\\" & $sComputerName & "\HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
Local $objWMIService, $colAdapters, $colAdaptersConfig, $iRet
$objWMIService = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\" & $sComputerName & "\root\CIMV2")
$colAdapters = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapter Where NetConnectionID = "' & $sNetConnectionID & '"')
For $objAdapter In $colAdapters
$colAdaptersConfig = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True And MACAddress = "' & $objAdapter.MACAddress & '"')
For $objAdapterConfig In $colAdaptersConfig
$iRet = RegWrite($sKey & $objAdapterConfig.SettingID & "\Connection", "ShowIcon", "REG_DWORD", $iFlag)
Next
Next
Return SetError($iRet = 0, 0, $iRet)
EndFunc;==> _Network_SetIcon
Regards.
#9
Posted 27 October 2008 - 02:40 PM
#include-once
; #FUNCTION# ====================================================================================================
==================================================================
;
; Name...........: _Network_SetIcon
; Description ...: Shows or hides the network icon in notification area when connected.
; Syntax.........: _Network_SetIcon($sNetConnectionID [, $iFlag, $sComputerName])
; Parameters ....: $sNetConnectionID - Name of the network connection.
; $iFlag - [Optional] A flag indicating the behaviour of the network icon:
; 0 - Icon in notification area when connected remains hidden.
; 1 - Icon in notification area when connected is shown.
; Default is "1".
; $sComputerName - [Optional] Computer name.
; The local computer is default.
; Return values .: Success - Returns 1
; Failure - Returns 0 and sets @error:
; Author ........: artbio
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ====================================================================================================
=============================================================================
Func _Network_SetIcon($sNetConnectionID, $iFlag = 1, $sComputerName = @ComputerName)
Local Const $sRootKey = "\\" & $sComputerName & "\HKLM\SYSTEM\CurrentControlSet\"
Local $objWMIService, $colWAN, $sClassGUID, $colAdapters, $colConfig, $iRet = 0
$objWMIService = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\" & $sComputerName & "\root\CIMV2")
$colWAN = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapter Where Name = "WAN Miniport (IP)"')
For $objWAN In $colWAN
$sClassGUID = RegRead($sRootKey & "Enum\" & $objWAN.PNPDeviceID, "ClassGUID")
If Not @error Then
$colAdapters = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapter Where NetConnectionID = "' & $sNetConnectionID & '"')
For $objAdapter In $colAdapters
$colConfig = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True And MACAddress = "' & $objAdapter.MACAddress & '"')
For $objConfig In $colConfig
$iRet = RegWrite($sRootKey & "Control\Network\" & $sClassGUID & "\" & $objConfig.SettingID & "\Connection", "ShowIcon", "REG_DWORD", $iFlag)
Next
Next
EndIf
Next
Return SetError($iRet = 0, 0, $iRet)
EndFunc;==> _Network_SetIcon
#10
Posted 29 January 2010 - 06:07 PM
Yzöwl, on Jun 20 2007, 10:01 PM, said:
Here's a single line batch file solution
@FOR /F "DELIMS=" %%? IN ('REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} /S^|FINDSTR \\Connection$') DO @REG ADD "%%?" /V ShowIcon /T REG_DWORD /D 1 /F>NUL
thank u so much , worked great with me and also very simple
This post has been edited by Oxygen: 29 January 2010 - 06:08 PM



Help
Back to top










