Jump to content
Ascend4nt

Network Interface Info, Statistics, and Traffic

Recommended Posts

Works on 7 x64. Thanks for sharing.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Thanks for the tests.  Btw, my 'splash window' height calculations aren't very scientific as you've seen from my other thread. :unsure:


Share this post


Link to post
Share on other sites

Ok, fine.  I'm never happy leaving things looking halfway done.  Now I've added IP and ICMP statistics.  See 1st post. Oh, and ICMP doesn't change that often - to force an increase, do a 'ping' from the command prompt.


Share this post


Link to post
Share on other sites

The splash screen is OK this time. I tested the new version and pinged a machine, it registered the packet being sent with your UDF.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

I've update this UDF with a bunch of more information.  Network adapters and interfaces are now queryable. Arrays of information about each network interface are now returned from certain functions.  Inside the arrays are indexes which can be used to query network statistics for each network interface.

This is a pretty big change from my first version of Network Statistics (I call it version 2!), so if anyone inquires about it, I could upload the old version again.  However, I plan to split the main UDF from the example in the future.

Updates:

2013-07-02:

 Fixed: indexing, updated and enhanced output

 Changed: Various functions return arrays even if failure - this is to make XP pre-SP1 and also collection of IPv6 less troublesome. @error should still be checked on return though!

 Added: Adapter and Interface information and statistics collection

See the first post


Share this post


Link to post
Share on other sites

I'm getting an error:

C:\_Downloads\NetworkStatistics.au3 (1267) : ==> Subscript used with non-Array variable.:
ConsoleWrite("Interface #"&$i+1&" Entry Info: [0] Interface Index = " & $aNIEntryInfo[0] & ", [1] Interface Type = " & $aNIEntryInfo[1] & ", ...
ConsoleWrite("Interface #"&$i+1&" Entry Info: [0] Interface Index = " & $aNIEntryInfo^ ERROR

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

UEZ, thanks.. can you insert this line after the call to _Network_InterfaceInfo() and tell me what it reports?:

ConsoleWrite("_Network_InterfaceEntryInfo return, @error = " & @error & ", @extended = " & @extended & @CRLF)

Also, is there information reported to the console from the call to _Network_IPAllAddressTable() on?  I've tested this so far in 3 different VM environments, so I was hopeful.. <_<


Share this post


Link to post
Share on other sites

Sure.

Output:

_Network_InterfaceEntryInfo return, @error = 3, @extended = 2

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

That is really really peculiar.  There's nothing in the documentation for GetIfEntry that mentions ERROR_FILE_NOT_FOUND (2), and in light of what the function does it really makes no sense to give that specific error.

I also asked if you had any console output from the call to _Network_IPAllAddressTable() onwards.  It seems it must return an array if it doesn't crash until _Network_InterfaceInfo()..  does the data look valid? Perhaps adding that ConsoleWrite() debug message after a call to that function could help as well.

The only thing I can guess right now is that there's an index # that isn't matching up somewhere..

thanks again for your help


Share this post


Link to post
Share on other sites

This is the complete output:

IP [IPv4] Stats: [0]  = IP Forwarding Status: [1 = Enabled, 2 = Disabled] : 2, [1]  = Default initial time-to-live (TTL) for datagrams : 64
, [2]  = # Received Datagrams : 97579, [3]  = # Received Datagrams w/Header errors : 0, [4]  = # Received Datagrams w/Address errors : 14
, [5]  = # Forwarded Datagrams : 0, [6]  = # Received Datagrams w/Unknown Protocol : 0, [7]  = # Received Datagrams Discarded : 366
, [8]  = # Received Datagrams Delivered : 99864, [9]  = # Requested Outgoing Datagrams : 79017, [10] = # Outgoing Datagrams Discarded : 0
, [11] = # Transmitted Datagrams Discarded : 0, [12] = # Datagrams w/o Routes that were Discarded : 0, [13] = TimeOut for Reassembling Incoming Fragmented Datagrams : 60
, [14] = # Datagrams Requiring Reassembly : 0, [15] = # Datagrams Successfully Reassembled : 0, [16] = # Datagrams that Failed to be Reassembled : 0
, [17] = # Datagrams that were Fragmented Successfully : 0, [18] = # Datagrams not Fragmented, and Discarded : 0, [19] = # Fragments created (for Datagrams) : 0
, [20] = # of Interfaces : 6, [21] = # of IP addresses associated with PC : 43, [22] = # of Routes in the Routing table : 14
-----------------------------------------
IP [IPv6] Stats: [0]  = IP Forwarding Status: [1 = Enabled, 2 = Disabled] : 2, [1]  = Default initial time-to-live (TTL) for datagrams : 128
, [2]  = # Received Datagrams : 0, [3]  = # Received Datagrams w/Header errors : 0, [4]  = # Received Datagrams w/Address errors : 0
, [5]  = # Forwarded Datagrams : 0, [6]  = # Received Datagrams w/Unknown Protocol : 0, [7]  = # Received Datagrams Discarded : 111
, [8]  = # Received Datagrams Delivered : 0, [9]  = # Requested Outgoing Datagrams : 800, [10] = # Outgoing Datagrams Discarded : 0
, [11] = # Transmitted Datagrams Discarded : 0, [12] = # Datagrams w/o Routes that were Discarded : 8, [13] = TimeOut for Reassembling Incoming Fragmented Datagrams : 60
, [14] = # Datagrams Requiring Reassembly : 0, [15] = # Datagrams Successfully Reassembled : 0, [16] = # Datagrams that Failed to be Reassembled : 0
, [17] = # Datagrams that were Fragmented Successfully : 0, [18] = # Datagrams not Fragmented, and Discarded : 0, [19] = # Fragments created (for Datagrams) : 0
, [20] = # of Interfaces : 10, [21] = # of IP addresses associated with PC : 30, [22] = # of Routes in the Routing table : 13
-----------------------------------------
TCP [IPv4] Stats:[0] Rto Algorithm = 3,[1] Rto Min = 10,[2] Rto Max = 4294967295,[3] #Max Connections = 4294967295,[4] #Active Opens = 1656,[5] #Passive Opens = 17
 [6] #Failed Connection Attempts = 1508,[7] #Established Connections that were Reset = 359,[8] #Established Connections [current] = 26
 [9] #Recvd Segments = 95689,[10] #Sent Segments = 73938,[11] #Retransmitted Segments = 3735
 [12] #Receive Errors = 0,[13] #Sent Segments with Reset Flag = 2058,[14] #Connections = 87
-----------------------------------------
TCP [IPv6] Stats:[0] Rto Algorithm = 3,[1] Rto Min = 10,[2] Rto Max = 4294967295,[3] #Max Connections = 4294967295,[4] #Active Opens = 0,[5] #Passive Opens = 0
 [6] #Failed Connection Attempts = 0,[7] #Established Connections that were Reset = 0,[8] #Established Connections [current] = 0
 [9] #Recvd Segments = 0,[10] #Sent Segments = 0,[11] #Retransmitted Segments = 0
 [12] #Receive Errors = 0,[13] #Sent Segments with Reset Flag = 0,[14] #Connections = 59
-----------------------------------------
UDP [IPv4] Stats: [0] #Recvd Datagrams = 9163,[1] #Discarded Datagrams [invalid port] = 359,[2] #Erroneous Datagrams = 7
 [3] #Sent Datagrams = 4827,[4] #UDP Listener Entries = 27
-----------------------------------------
UDP [IPv6] Stats: [0] #Recvd Datagrams = 0,[1] #Discarded Datagrams [invalid port] = 111,[2] #Erroneous Datagrams = 0
 [3] #Sent Datagrams = 657,[4] #UDP Listener Entries = 7
-----------------------------------------
ICMP [IPv4] Stats: [0] = # Incoming ICMP Messages : 10, [1] = # Incoming ICMP Errors : 0, [2] = # Outgoing ICMP Messages : 13, [3] = # Outgoing ICMP Errors : 0
-----------------------------------------
ICMP [IPv6] Stats: [0] = # Incoming ICMP Messages : 0, [1] = # Incoming ICMP Errors : 0, [2] = # Outgoing ICMP Messages : 35, [3] = # Outgoing ICMP Errors : 0
-----------------------------------------
# of adapters: 5
Adapter Index #13, Name = \DEVICE\TCPIP_{F5C17D50-4BE2-4008-BA0A-76067ABE7DE2}
Adapter Index #849, Name = \DEVICE\TCPIP_{4CD51587-472C-41E3-B0FD-C92CDA50FB20}
Adapter Index #786, Name = \DEVICE\TCPIP_{B73941B0-2376-4882-B70B-76B0F0ED8209}
Adapter Index #787, Name = \DEVICE\TCPIP_{B08246C5-DAC4-4823-A0A2-BD3F077BF4CC}
Adapter Index #15, Name = \DEVICE\TCPIP_{D2D5B3E5-1958-4C19-A719-BC16A5ABB6C5}
-----------------------------------------
+ Added Interface (index #0), Intel(R) 82577LM Gigabit Network Connection
+ Added Interface (index #786), VMware Virtual Ethernet Adapter for VMnet1
+ Added Interface (index #787), VMware Virtual Ethernet Adapter for VMnet8
+ Added Interface (index #849), VirtualBox Host-Only Ethernet Adapter
+ Added Interface (index #862), Microsoft 6to4 Adapter
Interface #1: [0] Index #0, [1] Type = 6, [2] Operational Status = 1, [3] Flags = 0x000000C5, [4] Physical [MAC] Address: 88-AE-1D-B1-08-30, [5] MTU =  1500
, [6] Description: Intel(R) 82577LM Gigabit Network Connection, [7] Friendly Name: Local Area Connection, [8] Adapter/Service Name [GUID] = {F5C17D50-4BE2-4008-BA0A-76067ABE7DE2}
, [9] Max Receive Speed [Vista+] = 100000000, [10] Max Transmit Speed [Vista+] = 100000000
, [11] IPv4 Address(es): 168.185.212.21, [12] IPv6 Address(es): 
, [13] Connection Type [Vista+] = 1, [14] Tunnel Type [Vista+] = 0
_Network_InterfaceEntryInfo return, @error = 3, @extended = 2
C:\_Downloads\NetworkStatistics.au3 (1268) : ==> Subscript used with non-Array variable.:
ConsoleWrite("Interface #"&$i+1&" Entry Info: [0] Interface Index = " & $aNIEntryInfo[0] & ", [1] Interface Type = " & $aNIEntryInfo[1] & ", [2] Operational Status = " & $aNIEntryInfo[2] & ", [3] Admin Status = " & $aNIEntryInfo[3] & ", [4] Physical Address = " & $aNIEntryInfo[4] & ", [5] MTU [Max Trans. Unit] in bytes = " & $aNIEntryInfo[5] & @CRLF & ", [6] Description = " & $aNIEntryInfo[6] & ", [7] Interface Name = " & $aNIEntryInfo[7] & @CRLF & ", [8] Last change [1/100th second] = " & $aNIEntryInfo[8] & ", [9] Interface Speed [bps] = " & $aNIEntryInfo[9] & @CRLF & ", [10] # Recvd Data [in Octets] = " & $aNIEntryInfo[10] & ", [11] # Recvd Unicast Packets = " & $aNIEntryInfo[11] & ", [12] # Recvd Non-Unicast Packets = " & $aNIEntryInfo[12] & ", [13] # Recvd Packets Discarded [no error] = " & $aNIEntryInfo[13] & ", [14] # Recvd Packets Discarded [error] = " & $aNIEntryInfo[14] & ", [15] # Recvd Packets Discarded [unk. protocol] = " & $aNIEntryInfo[15] & @CRLF & ", [16] # Sent Data [in Octets] = " & $aNIEntryInfo[16] & ", [17] # Sent Unicast Packets = " & $aNIEntryInfo[17] & ", [18] # Sent Non-Unicast Packets = " & $aNIEntryInfo[18] & ", [19] # Sent Packets Discarded [no error] = " & $aNIEntryInfo[19] & ", [20] # Sent Packets Discarded [error] = " & $aNIEntryInfo[20] & @CRLF & ", [21] Transmit Queue Length [n/a] = " & $aNIEntryInfo[21] & @CRLF)
ConsoleWrite("Interface #"&$i+1&" Entry Info: [0] Interface Index = " & $aNIEntryInfo^ ERROR
->11:51:04 AutoIt3.exe ended.rc:1

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thanks, I'm gonna review it and see if there's something askew.  I haven't seen an index # 0 yet, so that's curious..


Share this post


Link to post
Share on other sites

Okay, apparently that 0 index is wrong and should be 13.  I *believe* this is due to my checks against IPv6Index.  Could you possibly locate the line

               " If $nIPAAStSize > 108 Then    ; XP SP1+ O/S Structure?"

and change that and the whole IF-Endif to read this:

                If $nIPAAStSize > 108 Then    ; XP SP1+ O/S Structure?
                    ; If IPv6 index is different than IPv4 Index, AND non-zero, use the latter
                    $nTemp = DllStructGetData($stIP_ADAPTER_ADDRESSES, "Ipv6IfIndex")
                    If $nTemp And $nTemp <> $aIPAddrTableEntries[$nNumEntries][0] Then
                        $aIPAddrTableEntries[$nNumEntries][0] = $nTemp
                    EndIf
                EndIf

Hopefully that would fix the problem.  I'm still not even sure if its worth checking Ipv6IfIndex yet, so I may modify that in the future.  However, the above code at least tests for a 0 condition, and won't change an index if Ipv6IfIndex is 0.

Thanks!


Share this post


Link to post
Share on other sites

nice!  New version uploaded!  Thx for the help spotting the error

Edited by Ascend4nt

Share this post


Link to post
Share on other sites

I Got Eror..

When I'm Disconnect Modem..

LINE 1340

$sSplashText &=StringFormat("%45,56s", $aNIEntryInfo[6] & @CRLF
$sSplashText &=StringFormat("%45,56s", $aNIEntryInfo^ ERROR
     
Error: Subscript used with non-Array variable

Edited by setengahgila

Share this post


Link to post
Share on other sites

I Got Eror..

When I'm Disconnect Modem..

....

 

A modem?! Really? :o   I thought those were all gone by now haha..

But anyway.. to the problem.  If you disconnect or disable a network interface, the index # assigned to it will fail to work, or possibly be reassigned when the device is reenabled.  But, just to be thorough here.. could you please insert this code and let me know what it reports when you disconnect the modem:

        $aNIEntryInfo = _Network_InterfaceEntryInfo($aIPAllAddrTable[$i][0])
        If @error Then
            ConsoleWrite("_Network_InterfaceEntryInfo return, @error = " & @error & ", @extended = " & @extended & @CRLF)
            ExitLoop
        EndIf

That goes in the For $i = 0 To $nIPs - 1 loop, line 1334.  It *should* return error code ERROR_NOT_FOUND (1168), if I understand it correctly.

The only way to get around the problem of disconnected devices is to rescan for devices using _Network_IPAllAddressTable().  But before we go there, it'd be good to see what kind of error code is returned.

Thanks for your help


Share this post


Link to post
Share on other sites

Updated today - version 3 (by my reckoning)!  This is now a full fledged Network Interface Information and Statistics UDF module.

2013-07-06:

 Added: Much more Adapter Information

 Changed: Example is now separate from the UDF

 Fixed some minor issues here and there

 Changed: Global Handle to IPHLPAPI.DLL is now contained in the UDF and used to speed up function calls

 Misc. Other fixes I didn't keep track of!

See 1st post, which is now a bit more detailed


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

  • Similar Content

    • By _Vlad
      Hello forum,
      I want to create a program with multiple menus and many elements inside. The problem is my way of doing this and below I have an example of how I do these menus.
      I know it's a bad way of doing them as using this method for more elements and menus cause big flickering.
       
      Can someone please help me with some tips of optimizing this or tell me another way of creating that menus with many elements without cause flickering? From a long time ago I still try to solve this but without any results, just small improvements.
      Many thanks for everyone.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $MENU_HOVER = '' Global $MENU_SELECTED = '' Global $COLOR_STANDARD = 0x94A5E9 Global $COLOR_HOVER = 0x8292d1 Global $COLOR_SELECTED = 0x7584bf $MENU = GUICreate("Menu", 615, 437, -1, -1, -1, -1, 0) GUISetFont(10, 400, 0, "Arial") $MENU_1 = GUICtrlCreateLabel("Menu 1", 8, 24, 106, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $MENU_2 = GUICtrlCreateLabel("Menu 2", 8, 56, 106, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $MENU_3 = GUICtrlCreateLabel("Menu 3", 8, 88, 106, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE)) ;MENU 1 ELEMENTS $MENU_1_ELEMENT_1 = GUICtrlCreateButton("Menu1 Button", 128, 24, 147, 25) ;MENU 2 ELEMENTS $MENU_2_ELEMENT_1 = GUICtrlCreateButton("Menu2 Button", 128, 24, 147, 25) $MENU_2_ELEMENT_2 = GUICtrlCreateLabel("Another element", 128, 64, 99, 20) _Design() _Hide_All() GUISetState(@SW_SHOW, $MENU) While 1 $Cursor = GUIGetCursorInfo($MENU) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MENU_1 _Previous_Selected_Cancel() $MENU_SELECTED = 'Menu1' GUICtrlSetBkColor($MENU_1, $COLOR_SELECTED) _Show('Menu1') Case $MENU_2 _Previous_Selected_Cancel() $MENU_SELECTED = 'Menu2' GUICtrlSetBkColor($MENU_2, $COLOR_SELECTED) _Show('Menu2') Case $MENU_3 _Previous_Selected_Cancel() $MENU_SELECTED = 'Menu3' GUICtrlSetBkColor($MENU_3, $COLOR_SELECTED) _Show('Menu3') EndSwitch If $Cursor[4] = $MENU_1 Then If $MENU_HOVER <> 'Menu1' And $MENU_SELECTED <> 'Menu1' Then _Previous_Hover_Cancel() GUICtrlSetBkColor($MENU_1, $COLOR_HOVER) $MENU_HOVER = 'Menu1' EndIf ElseIf $Cursor[4] = $MENU_2 Then If $MENU_HOVER <> 'Menu2' And $MENU_SELECTED <> 'Menu2' Then _Previous_Hover_Cancel() GUICtrlSetBkColor($MENU_2, $COLOR_HOVER) $MENU_HOVER = 'Menu2' EndIf ElseIf $Cursor[4] = $MENU_3 Then If $MENU_HOVER <> 'Menu3' And $MENU_SELECTED <> 'Menu3' Then _Previous_Hover_Cancel() GUICtrlSetBkColor($MENU_3, $COLOR_HOVER) $MENU_HOVER = 'Menu3' EndIf Else _Previous_Hover_Cancel() $MENU_HOVER = 'Idle' EndIf WEnd Func _Design() GUICtrlSetColor($MENU_1, 0xFFFFFF) GUICtrlSetBkColor($MENU_1, $COLOR_STANDARD) GUICtrlSetCursor($MENU_1, 0) GUICtrlSetColor($MENU_2, 0xFFFFFF) GUICtrlSetBkColor($MENU_2, $COLOR_STANDARD) GUICtrlSetCursor($MENU_2, 0) GUICtrlSetColor($MENU_3, 0xFFFFFF) GUICtrlSetBkColor($MENU_3, $COLOR_STANDARD) GUICtrlSetCursor($MENU_3, 0) EndFunc ;==>_Design Func _Hide_All() GUICtrlSetState($MENU_1_ELEMENT_1, $GUI_HIDE) GUICtrlSetState($MENU_2_ELEMENT_1, $GUI_HIDE) GUICtrlSetState($MENU_2_ELEMENT_2, $GUI_HIDE) EndFunc ;==>_Hide_All Func _Show($MENU_SHOW) _Hide_All() If $MENU_SHOW = 'Menu1' Then GUICtrlSetState($MENU_1_ELEMENT_1, $GUI_SHOW) ElseIf $MENU_SHOW = 'Menu2' Then GUICtrlSetState($MENU_2_ELEMENT_1, $GUI_SHOW) GUICtrlSetState($MENU_2_ELEMENT_2, $GUI_SHOW) ElseIf $MENU_SHOW = 'Menu3' Then EndIf EndFunc ;==>_Show Func _Previous_Hover_Cancel() If $MENU_HOVER = 'Menu1' Then If $MENU_SELECTED <> 'Menu1' Then GUICtrlSetBkColor($MENU_1, $COLOR_STANDARD) ElseIf $MENU_HOVER = 'Menu2' Then If $MENU_SELECTED <> 'Menu2' Then GUICtrlSetBkColor($MENU_2, $COLOR_STANDARD) ElseIf $MENU_HOVER = 'Menu3' Then If $MENU_SELECTED <> 'Menu3' Then GUICtrlSetBkColor($MENU_3, $COLOR_STANDARD) EndIf EndFunc ;==>_Previous_Hover_Cancel Func _Previous_Selected_Cancel() If $MENU_SELECTED = 'Menu1' Then GUICtrlSetBkColor($MENU_1, $COLOR_STANDARD) If $MENU_SELECTED = 'Menu2' Then GUICtrlSetBkColor($MENU_2, $COLOR_STANDARD) If $MENU_SELECTED = 'Menu3' Then GUICtrlSetBkColor($MENU_3, $COLOR_STANDARD) EndFunc ;==>_Previous_Selected_Cancel  
    • By tarretarretarre
      Autoit-Socket-IO
      Introduction
      Autoit-Socket-IO is a event driven TCP/IP wrapper heavily inspired from Socket.IO with focus on user friendliness and long term sustainability.
      I created this UDF because I was fascinated how Socket.IO made a such scary task "reliable and secure networking" so simple for the developer. So this was my main motivation.
      I constantly want to make this UDF faster and better, so if you have any suggestions. Do not hesitate to make requests!
      Features
      Flexiable and easy to understand API Above avarage documentation "Fully featured" examples Security in form of data encryption and middleware-support Limitations
      Speed. Because I want this UDF to be as flexible and simple as possible. Sometimes speed is sacrificed, but that does not mean i don't try to . It is not possible to emit objects mainly because autoit does not support serialization. Only 1D-arrays can be emitted (2D arrays will probably never be supported) Success story
      Since December 2017-now I have used version 1.5.0 in an production environment for 40+ clients with great success, the only downtime is planned windows updates and power outages.
      Getting started
      Download the script from AutoIt or pull it from the official github repo git@github.com:tarreislam/Autoit-Socket-IO.git and checkout the tag 2.0.0 The documentation is located at Docs\index.html Take a look in the examples/ folder Changelog
      Version 2.0.0 (This update break scripts. Please consult the upgrade.md for guidance)
      All global internal variables has been renamed. Added a bunch of new API methods: _Io_RegisterMiddleware, _Io_whoAmI, _Io_IsClient, _Io_IsServer, _Io_getAllByProperty and _Io_getFirstByProperty and some more. Read more about these in the documentation. _Io_socketGetProperty now has a setter method called _Io_socketSetProperty which can be used to set custom properties. _Io_socketGetProperty now has a third parameter "default" which is used when a property is not found Removed _Io_setEventPostScript and _Io_setEventPretScript in favor of _Io_RegisterMiddleware Improved documentation (It still needs some love though) Improved the verbosity of _Io_DevDebug  
      Newest version (2019-09-29!)
      Autoit-Socket-IO-2.0.0.zip
      Older versions (Not supported anymore)
      Autoit-Socket-IO-1.0.0.zip Autoit-Socket-IO-1.1.0.zip Autoit-Socket-IO-1.3.0.zip Autoit-Socket-IO-1.4.0.zip Autoit-Socket-IO-1.5.0.zip
    • By AoRaToS
      I started working on this program in the summer of 2008 then I stopped cause I faced some problems I couldn't overcome back then. Now that I've practiced more and have become a better scripter/programmer I'm releasing the program to the public to get some opinions. I know it's not a new concept but it's the first program I started besides some small stuff I did just for practice! I won't post the source code yet because it's still under construction, although I'm sure I've posted early stages of the code with bugs in the past in some topic...
      What I wanted was a simple, small, serverless program that would work without installation cause I wanted it for where I work, so I ended up with this!
      I have attached some images of various versions, also visit the forum thread.
      The package includes s!mpL3 LAN Messenger and the full change log.
      Current version 2.9.9.1! [04/07/2019]
      Check the Change Log below!
       
       
      http://www.autoitscript.com/forum/index.php?showtopic=88782
       
       
       
      Read the license before using this software.
       
    • By rudi
      Hi.
      The final question first: Is there a reason, that Autoit doesn't clean up RAM usage as a standard feature?
       
      This posting by @guinness was pointing me to the solution for solving my problem:
      https://www.autoitscript.com/forum/topic/131315-accumulating-memory-usage/?do=findComment&comment=914208
      DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1) this simple, single line called on a regular basis stopped the script consuming more and more RAM.
      CU, Rudi.
×
×
  • Create New...