Jazkal Posted August 3, 2009 Posted August 3, 2009 Would like to see the source, if you don't mind sharing.
playlet Posted August 15, 2009 Author Posted August 15, 2009 (edited) --- Edited August 18, 2016 by playlet
mrmacadamia Posted October 8, 2009 Posted October 8, 2009 I updated the source code above - removed some unnecessary lines from the code.Cheers, PlayletHow about before checking the status is 'enable or disable', the script should also check if the computer has the LAN adapter or not? Because I have a old notebook without LAN adapter.
playlet Posted October 8, 2009 Author Posted October 8, 2009 (edited) --- Edited August 18, 2016 by playlet
mrmacadamia Posted October 13, 2009 Posted October 13, 2009 (edited) This could be a little tricky since I don't know what actually happens with the script on a computer that doesn't have a lan adapter. Try this: Dim $aNetworkInfo $cI_CompName = @ComputerName Global $wbemFlagReturnImmediately = 0x10, _ $wbemFlagForwardOnly = 0x20 _ComputerGetNetworkCards($aNetworkInfo) $networkcard = $aNetworkInfo[1][0] If $networkcard <> "" Then MsgBox (0, "True", "You have a network card installed: " & @CRLF & @CRLF & $networkcard) Else MsgBox (0, "False", "No network cards !") EndIf Func _ComputerGetNetworkCards(ByRef $aNetworkInfo) Local $colItems, $objWMIService, $objItem Dim $aNetworkInfo[1][34], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems ReDim $aNetworkInfo[UBound($aNetworkInfo) + 1][34] $aNetworkInfo[$i][0] = $objItem.Name $i += 1 Next $aNetworkInfo[0][0] = UBound($aNetworkInfo) - 1 If $aNetworkInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Else SetError(1, 2, 0) EndIf EndFuncand tell me what the MessageBox tells you. "True" "You have a network card installed: RAS Asynchronization adaptor" Actually it is not LAN adapter, this is a modem adapter. Edited October 13, 2009 by mrmacadamia
playlet Posted October 13, 2009 Author Posted October 13, 2009 (edited) --- Edited August 18, 2016 by playlet
spudw2k Posted October 14, 2009 Posted October 14, 2009 ...I've changed this function to look for specific words like "lan" or "ethernet"....You could also try filtering the WMI query to look for network devices that have an IP associated with them. Spoiler Things I've Made: Always On Top Tool ◊ AU History â—ŠÂ Deck of Cards â—Š HideIt â—Š ICU â—Š Icon Freezer â—Š Ipod Ejector â—Š Junos Configuration Explorer â—Š Link Downloader â—Š MD5 Folder Enumerator â—Š PassGen â—ŠÂ Ping Tool â—Š Quick NIC â—Š Read OCR â—Š RemoteIT â—Š SchTasksGui â—Š SpyCam â—Š System Scan Report Tool â—Š System UpTime â—Š Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example â—Š CheckHover ◊ Detect SafeMode â—Š DynEnumArray â—Š GetNetStatData ◊ HashArray â—Š IsBetweenDates â—Š Local Admins â—Š Make Choice â—Š Recursive File List â—Š Remove Sizebox Style â—Š Retrieve PNPDeviceID â—Š Retrieve SysListView32 Contents â—Š Set IE Homepage â—Š Tickle Expired Password â—Š Transpose Array Projects: Drive Space Usage GUI â—ŠÂ LEDkIT â—Š Plasma_kIt â—ŠÂ Scan Engine Builder â—Š SpeeDBurner â—Š SubnetCalc Cool Stuff: AutoItObject UDF â—Š Extract Icon From Proc â—Š GuiCtrlFontRotate â—Š Hex Edit Funcs â—Š Run binary â—Š Service_UDF Â
playlet Posted October 14, 2009 Author Posted October 14, 2009 (edited) --- Edited August 18, 2016 by playlet
rajeshontheweb Posted October 26, 2009 Posted October 26, 2009 u might want to include wireless network connection in the StringInStr ... Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
FranckGr Posted October 26, 2009 Posted October 26, 2009 I found 26 NICs on my system (9 with your filter).OnBoard Broadcom NetXtreme 57xx Gigabit Controller Miniport d'ordonnancement de paquets Miniport d'ordonnancement de paquetsConnexion 1394 Carte réseau 1394 Miniport d'ordonnancement de paquets Deterministic Network Enhancer Miniport Deterministic Network Enhancer Miniport Virtual Machine Network Services Driver VirtualBox Bridged Networking Driver MiniportSo I modified your code like this :For $i=1 to $aNetworkInfo[0][0] If StringInStr($aNetworkInfo[$i][1],'Ethernet')>0 and $aNetworkInfo[$i][19]<>"" and StringInStr($aNetworkInfo[$i][0],"1394")=0 Then ConsoleWrite($aNetworkInfo[$i][19]&@TAB&$aNetworkInfo[$i][0]&@CR) $lan = 1 EndIfNextOnly "Ethernet" Nics, Only visible in "Nework Connections" and not a "1394" adapter.There is only one NIC left after this filter. The true one.OnBoard Broadcom NetXtreme 57xx Gigabit ControllerI like the $aNetworkInfo[$i][19] value !!! Every people asking for a NIC called exactly "Local area connection" in their script should use your function !Thanks for sharing.
playlet Posted October 26, 2009 Author Posted October 26, 2009 (edited) --- Edited August 18, 2016 by playlet
playlet Posted October 26, 2009 Author Posted October 26, 2009 (edited) --- Edited August 18, 2016 by playlet
playlet Posted January 26, 2010 Author Posted January 26, 2010 (edited) --- Edited August 18, 2016 by playlet
playlet Posted March 23, 2010 Author Posted March 23, 2010 (edited) --- Edited August 18, 2016 by playlet
playlet Posted August 3, 2010 Author Posted August 3, 2010 (edited) --- Edited August 18, 2016 by playlet
lee321987 Posted August 29, 2010 Posted August 29, 2010 Not working in Windows 7 x64. Is it supposed to? If I run from Scite: LAN Enable-Disable v2.3.au3 (75) : ==> Variable must be of type "Object".: If I compile and run it: Line 72 Error: Variable must be of type "Object". Thanks for all your work.
qwertyuiop Posted September 2, 2010 Posted September 2, 2010 Not working in Windows 7 x64. Is it supposed to? If I run from Scite: LAN Enable-Disable v2.3.au3 (75) : ==> Variable must be of type "Object".: If I compile and run it: Line 72 Error: Variable must be of type "Object". Thanks for all your work. I got the same error, then tried compiling it as 64-bit - fixed the problem for me.
playlet Posted September 3, 2010 Author Posted September 3, 2010 (edited) --- Edited August 18, 2016 by playlet
lee321987 Posted September 6, 2010 Posted September 6, 2010 x64 or x86 -- doesn't matter for me. Still getting error.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now