Leaderboard
Popular Content
Showing content with the highest reputation on 07/09/2014 in all areas
-
File Name: AutoIt v3.3.13.1 Beta File Submitter: Jon File Submitted: 09 Jul 2014 File Category: Beta 3.3.13.1 (9th July, 2014) (Beta) AutoIt: - Added: FileGetAttrib() returns encrypted attribute. - Added #2365: FileFindNextFile() - information in @extended. - Added #2647: Return the line count from FileReadToArray() in @extended. - Fixed: Functions fixed for extended length paths: FileOpen(), FileCopy(), FileMove(), FileDelete(). Click here to download this file2 points
-
Automate Qt and QWidgets
Piyu reacted to seangriffin for a topic
This post explains how to automate applications developed in Qt (http://qt.nokia.com) using AutoIT. This includes such popular applications as VLC, Google Earth, Skype, Virtual Box and Avidemux. Qt based applications contain widgets which are not immediately accessible through the Au3Info tool. There are many forum posts on the subject of querying Qt based applications using Au3Info, with the result that it returns only a single QWidget object for the entire application or window. Qt is a framework which wraps, or masks, the underlying native Win32 controls within it's GUI. Like other similar frameworks and languages (such as Java), Qt includes accessibility features which allow other non-Qt applications to interact with the framework. Tools like AutoIT can use these accessibility features to automate Qt applications. I have not yet found a Qt accessibility bridge which AutoIT can use (such as in the form of a Windows DLL). However, I have found a very useful tool called Ranorex Spy (http://www.ranorex.com/gui-testing-guide/spy.html), which uses the accessibility features of Qt to expose information about the QWidgets within an application, in a similar manner to Au3Info. There doesn't appear to be any license associated with Ranorex Spy, so I have attached the tool to this post for the benefit of others. Use Ranorex Spy in the same manner that you use Au3Info. With the application you want to automate already open, drag the Finder Tool (crosshair) in Ranorex Spy over the application, and you'll notice that it can identify the widgets within the application (in the same manner that Au3Info would). You can then use this information within the standard AutoIT function calls. Here are some examples. If the QWidget has a "Caption/text", as identified in Ranorex Spy, then use the following AutoIT call to click on that control: ControlClick("window title", "", "[TEXT:the Caption/text from Ranorex Spy]")If the QWidget doesn't have a "Caption/text", then you can use the "Handle" from Ranorex Spy instead. Paste the handle value into the following AutoIT script: Const $handle_to_find = "paste the handle from Ranorex Spy here" For $i = 1 to 1000 $handle = ControlGetHandle("window title", "", "[CLASS:QWidget; INSTANCE:" & $i & "]") if @error = 1 Then ExitLoop if ($handle = $handle_to_find) Then ConsoleWrite("Found QWidget handle " & $handle_to_find & " at instance: " & $i & @CRLF) ExitLoop EndIf Next Run the script and it should give you the QWidget instance number of the control. Use this instance number in the following AutoIT call to click on that control: ControlClick("window title", "", "[CLASS:QWidget; INSTANCE:insert the instance number here]")Hope this is useful to all those having trouble automating Qt. Apologies everyone, but I've had to remove the "RanorexSpy.zip" attachment because I've run out of upload quota for the site. Contact me if you'd like a copy.1 point -
Network Interface Info, Statistics, and Traffic
mesale0077 reacted to Ascend4nt for a topic
Network Interface Info, Statistics, and Traffic (incl. IP, TCP, UDP and ICMP) This is an example of getting and displaying Network Interface Information, Statistics and Traffic. Previously this was just a means to getting Network statistics (specifically IP, TCP, UDP, and ICMP), but now it includes Internet Interface information, as well as Interface-specific statistics. Since this UDF can be used in different ways, let me cover Statistics first: Network Statistics Information Stats example output To retrieve Statistics information, you can call one of the four _Network_xxxxStatistics() functions for IP, TCP, UDP, or ICMP Statistics. These functions accept 1 argument which specifies which protocol to use. Basically, zero is IPv4 and non-zero is IPv6. It defaults to IPv4 if no arguments. Here's the functions: Protocol Statistics Functions: _Network_IPStatistics() -> receives IP statistics _Network_TCPStatistics() -> TCP statistics _Network_UDPStatistics() -> UDP statistics _Network_ICMPStatistics() -> ICMP statistics - To get per-interface statistics requires 2 calls. One call is required to collect information on adapters into an array. Once this information is retrieved, multiple calls to _Network_InterfaceEntryInfo() can be made for each indexed network interface. Note that _Network_IPv4AdaptersInfo() is the only adapter/interface information function which doesn't get index information - so don't use it unless you want further interface information. The main UDF functions to use are: Network Adapter & Interface Functions: _Network_IPv4AdaptersInfo() -> Retrieves information on Physical IPv4 adapters _Network_IPv4AdaptersInfoEx() -> Retrieves much more info on Physical IPv4 adapters _Network_IPv4AddressTable() -> Retrieves information on IPv4 Interfaces _Network_IPAllAddressTable() -> Retrieves information on both IPv4 and IPv6 interfaces Network Statistics for a Given Interface: _Network_InterfaceEntryInfo() -> For a given interface index, retrieves statistics - The simplest way to get overall traffic is to use _Network_IPAllAddressTable() (or _Network_IPv4AddressTable() for IPv4 only) to collect an array of info about interfaces. This needs to be done only once. Then, to collect statistics, for each row in the interface array, call _Network_InterfaceEntryInfo() with $aIPAddressTable[$i][0] to get the statistics for that network interface. IMPORTANT: Note that for all statistics, the data received/sent are represented as 32-bit numbers, and subject to wraparound after 4GBs of data has been transferred. Network Interface Information Regarding Network Interface Information, nearly every function except those ending in xxStatistics(), will return various info regarding the network adapters or interfaces. Currently, IPv4 and IPv6 addresses are retrieved for the interface, as well as for Gateway, DHCP, DNS and WINS servers (there's some XP issues here as to which functions to use - see UDFs). The number of IP addresses (since there can be more than one assigned to each interface) is controlled via a parameter $bGetAllIPs. If this value is non-zero, multiple IP addresses are returned in a string separated by "|" (pipe symbol). Also note that the MAC/Physical Address is returned by most functions as well. These are properly formatted into a hex string in the form "01-23-45-67-89-ab". There is one issue with converting IPv6 addresses - on pre-Vista O/S's (Win XP I'm looking at you) WSAStartup must be called by the code. This is all handled internally, but if you have code that relies on WSAStartup/Cleanup, keep it in mind and let me know if I can better accommodate any potential conflicts. Further notes: - The TCP Statistics gives information about the number of segments sent/received, rather than the # of packets. I'm not totally clear on the association, however here's some links: What's the difference between a TCP segment and a TCP packet? Whats the difference between a Packet, Segment and Frame? - I'm not sure how segments, packets, or datagrams map to # of bytes, or what API functions I might use to figure this out. Any help there would be appreciated. Alternatives: While I have opened access to a lot of detailed network and performance information, there are alternatives - check out Netstat (-e for performance stats) or my >Performance Counters UDF's, which has a lot of varied stats (one example of these: >Network Usage). Following is the example, included in the ZIP file. Note there's a cr@pload of info dumped to the console, so you'll probably want to redirect output or copy-and-paste from the output console: ; ======================================================================================================== ; <NetworkStatsExample.au3> ; ; Example of reading and displaying Network Interface Information and Statistics ; (using <NetworkStatistics.au3> UDF) ; Statistics information, including IP, TCP*, UDP, and ICMP and internet interface traffic, ; are displayed in a 'Splash' window - with both IPv4 and IPv6 data separated ; ; Author: Ascend4nt ; ======================================================================================================== #include "_NetworkStatistics.au3" ; -------------------- HOTKEY FUNCTION & VARIABLE -------------------- Global $bHotKeyPressed = False Func _EscPressed() $bHotKeyPressed=True EndFunc ; -------------------- MAIN PROGRAM CODE -------------------- HotKeySet("{Esc}", "_EscPressed") Local $hSplash, $sSplashText ; Network Stats Local $aUDPStats, $aTCPStats, $aIPStats, $aICMPStats Local $aUDPv6Stats, $aTCPv6Stats, $aIPv6Stats, $aICMPv6Stats Local $aIPv4Adapters, $nAdapters Local $aIPv4AddrTable, $aIPAllAddrTable, $nInterfaces, $aNIEntryInfo Local $sSeparator = "-----------------------------------------" ; IP Stats: IPv4 and IPv6 For $i = 0 To 1 $aIPStats = _Network_IPStatistics($i) If @error Then ConsoleWrite("_Network_IPStatistics("&$i&") error: "&@error&", @extended="&@extended&@CRLF) ContinueLoop EndIf If $i Then ConsoleWrite("IP [IPv6] Stats:") Else ConsoleWrite("IP [IPv4] Stats:") EndIf ConsoleWrite( _ " [0] = IP Forwarding Status: [1 = Enabled, 2 = Disabled] : " & $aIPStats[0] & _ ", [1] = Default initial time-to-live (TTL) for datagrams : " & $aIPStats[1] & @CRLF & _ ", [2] = # Received Datagrams : " & $aIPStats[2] & _ ", [3] = # Received Datagrams w/Header errors : " & $aIPStats[3] & _ ", [4] = # Received Datagrams w/Address errors : " & $aIPStats[4] & @CRLF & _ ", [5] = # Forwarded Datagrams : " & $aIPStats[5] & _ ", [6] = # Received Datagrams w/Unknown Protocol : " & $aIPStats[6] & _ ", [7] = # Received Datagrams Discarded : " & $aIPStats[7] & @CRLF & _ ", [8] = # Received Datagrams Delivered : " & $aIPStats[8] & _ ", [9] = # Requested Outgoing Datagrams : " & $aIPStats[9] & _ ", [10] = # Outgoing Datagrams Discarded : " & $aIPStats[10] & @CRLF & _ ", [11] = # Transmitted Datagrams Discarded : " & $aIPStats[11] & _ ", [12] = # Datagrams w/o Routes that were Discarded : " & $aIPStats[12] & _ ", [13] = TimeOut for Reassembling Incoming Fragmented Datagrams : " & $aIPStats[13] & @CRLF & _ ", [14] = # Datagrams Requiring Reassembly : " & $aIPStats[14] & _ ", [15] = # Datagrams Successfully Reassembled : " & $aIPStats[15] & _ ", [16] = # Datagrams that Failed to be Reassembled : " & $aIPStats[16] & @CRLF & _ ", [17] = # Datagrams that were Fragmented Successfully : " & $aIPStats[17] & _ ", [18] = # Datagrams not Fragmented, and Discarded : " & $aIPStats[18] & _ ", [19] = # Fragments created (for Datagrams) : " & $aIPStats[19] & @CRLF & _ ", [20] = # of Interfaces : " & $aIPStats[20] & _ ", [21] = # of IP addresses associated with PC : " & $aIPStats[21] & _ ", [22] = # of Routes in the Routing table : " & $aIPStats[22] & _ @CRLF) ConsoleWrite($sSeparator & @CRLF) Next ; TCP Stats: IPv4 and IPv6 For $i = 0 To 1 $aTCPStats = _Network_TCPStatistics($i) If @error Then ConsoleWrite("_Network_TCPStatistics("&$i&") error: "&@error&", @extended="&@extended&@CRLF) ContinueLoop EndIf If $i Then ConsoleWrite("TCP [IPv6] Stats:") Else ConsoleWrite("TCP [IPv4] Stats:") EndIf ConsoleWrite( _ "[0] Rto Algorithm = " & $aTCPStats[0] & _ ",[1] Rto Min = " & $aTCPStats[1] & _ ",[2] Rto Max = " & $aTCPStats[2] & _ ",[3] #Max Connections = " & $aTCPStats[3] & _ ",[4] #Active Opens = " & $aTCPStats[4] & _ ",[5] #Passive Opens = " & $aTCPStats[5] & @CRLF & _ " [6] #Failed Connection Attempts = " & $aTCPStats[6] & _ ",[7] #Established Connections that were Reset = " & $aTCPStats[7] & _ ",[8] #Established Connections [current] = " & $aTCPStats[8] & @CRLF & _ " [9] #Recvd Segments = " & $aTCPStats[9] & _ ",[10] #Sent Segments = " & $aTCPStats[10] & _ ",[11] #Retransmitted Segments = " & $aTCPStats[11] & @CRLF & _ " [12] #Receive Errors = " & $aTCPStats[12] & _ ",[13] #Sent Segments with Reset Flag = " & $aTCPStats[13] & _ ",[14] #Connections = " & $aTCPStats[14] & _ @CRLF) ConsoleWrite($sSeparator & @CRLF) Next ; UDP Stats: IPv4 and IPv6 For $i = 0 To 1 $aUDPStats = _Network_UDPStatistics($i) If @error Then ConsoleWrite("_Network_UDPStatistics("&$i&") error: "&@error&", @extended="&@extended&@CRLF) ContinueLoop EndIf If $i Then ConsoleWrite("UDP [IPv6] Stats:") Else ConsoleWrite("UDP [IPv4] Stats:") EndIf ConsoleWrite( _ " [0] #Recvd Datagrams = " & $aUDPStats[0] & _ ",[1] #Discarded Datagrams [invalid port] = " & $aUDPStats[1] & _ ",[2] #Erroneous Datagrams = " & $aUDPStats[2] & @CRLF & _ " [3] #Sent Datagrams = " & $aUDPStats[3] & _ ",[4] #UDP Listener Entries = " & $aUDPStats[4] & _ @CRLF) ConsoleWrite($sSeparator & @CRLF) Next ; ICMP Stats: IPv4 and IPv6 For $i = 0 To 1 $aICMPStats = _Network_ICMPStatistics($i) If @error Then ConsoleWrite("_Network_ICMPStatistics("&$i&") error: "&@error&", @extended="&@extended&@CRLF) ContinueLoop EndIf ConsoleWrite("ICMP [IPv"&4+($i*2)&"] Stats:" & _ " [0] = # Incoming ICMP Messages : " & $aICMPStats[0] & _ ", [1] = # Incoming ICMP Errors : " & $aICMPStats[1] & _ ", [2] = # Outgoing ICMP Messages : " & $aICMPStats[2] & _ ", [3] = # Outgoing ICMP Errors : " & $aICMPStats[3] & _ @CRLF) ConsoleWrite($sSeparator & @CRLF) Next ; IPv4 Adapters Info (very basic info) _Network_IPv4AdaptersInfo() ConsoleWrite($sSeparator & @CRLF) ; IPv4 Adapters Info (comprehensive info) $aIPv4Adapters = _Network_IPv4AdaptersInfoEx() $nAdapters = @extended ConsoleWrite("# of Adapters: "&$nAdapters&@CRLF) For $i = 0 To $nAdapters - 1 ConsoleWrite("Adapter #"&$i+1&":" & _ " [0] Index #"& $aIPv4Adapters[$i][0] & _ ", [1] Type = " & $aIPv4Adapters[$i][1] & _ ", [2] DHCP Enabled Flag = " & $aIPv4Adapters[$i][2] & _ ", [3] WINS Enabled Flag = " & $aIPv4Adapters[$i][3] & _ ", [4] Physical [MAC] Address: " & $aIPv4Adapters[$i][4] & _ ", [5] (0) = " & $aIPv4Adapters[$i][5] & @CRLF & _ ", [6] Description: "& $aIPv4Adapters[$i][6] & _ ", [7] [Empty '']: " & $aIPv4Adapters[$i][7] & _ ", [8] Adapter/Service Name [GUID] = " & $aIPv4Adapters[$i][8] & _ ", [9] [Empty] = " & $aIPv4Adapters[$i][9] & _ ", [10] [Empty] = " & $aIPv4Adapters[$i][10] & @CRLF & _ ", [11] IPv4 Address(es): "& $aIPv4Adapters[$i][11] & _ ", [12] IP Address Mask(s): "& $aIPv4Adapters[$i][12] & @CRLF & _ ", [13] Gateway IPv4 Address(es): "& $aIPv4Adapters[$i][13] & _ ", [14] Gateway Address Mask(s) : "& $aIPv4Adapters[$i][14] & @CRLF & _ ", [15] DHCP IPv4 Address(es) = " & $aIPv4Adapters[$i][15] & _ ", [16] DHCP Address Mask(s) = " & $aIPv4Adapters[$i][16] & _ ", [17] DHCP LeaseObtained Time = " & $aIPv4Adapters[$i][17] & _ ", [18] DHCP LeaseExpires Time = " & $aIPv4Adapters[$i][18] & @CRLF & _ ", [19] Primary WINS Server IP = " & $aIPv4Adapters[$i][19] & _ ", [20] Primary WINS Server Address Mask = " & $aIPv4Adapters[$i][20] & _ ", [21] Secondary WINS Server IP(s) = " & $aIPv4Adapters[$i][21] & _ ", [22] Secondary WINS Server Address Mask(s) = " & $aIPv4Adapters[$i][22] & @CRLF) ConsoleWrite($sSeparator & @CRLF) Next ; IPv4 Interface Info alt #2 $aIPv4AddrTable = _Network_IPv4AddressTable() $nInterfaces = @extended ConsoleWrite(@CRLF) For $i = 0 To $nInterfaces - 1 ConsoleWrite("Adapter #"&$i+1&": [0] Interface Index # = " & $aIPv4AddrTable[$i][0] & _ ", [1] IPv4 Address = " & $aIPv4AddrTable[$i][1] & _ ", [2] Subnet Mask = " & $aIPv4AddrTable[$i][2] & _ ", [3] Broadcast Address = " & $aIPv4AddrTable[$i][3] & @CRLF & _ " [4] Max Reassembly Size = " & $aIPv4AddrTable[$i][4] & _ ", [5] Address Type/State = " & $aIPv4AddrTable[$i][5] & @CRLF) Next ConsoleWrite($sSeparator & @CRLF) ; IPv4 and IPv6 Interface Info (includes everything except Address Masks) ; params: 0 (IPv4 AND IPv6), 0 (don't get all IP's), 0 (don't include down-status interfaces) $aIPAllAddrTable = _Network_IPAllAddressTable(0, 0, 0) $nInterfaces = @extended ConsoleWrite($sSeparator & @CRLF) For $i = 0 To $nInterfaces - 1 ConsoleWrite("Interface #"&$i+1&": [0] Index #"& $aIPAllAddrTable[$i][0] & _ ", [1] Type = " & $aIPAllAddrTable[$i][1] & _ ", [2] Operational Status = " & $aIPAllAddrTable[$i][2] & _ ", [3] Flags = 0x" & Hex($aIPAllAddrTable[$i][3], 8) & _ ", [4] Physical [MAC] Address: " & $aIPAllAddrTable[$i][4] & _ ", [5] MTU = " & $aIPAllAddrTable[$i][5] & @CRLF & _ ", [6] Description: "& $aIPAllAddrTable[$i][6] & _ ", [7] Friendly Name: " & $aIPAllAddrTable[$i][7] & _ ", [8] Adapter/Service Name [GUID] = " & $aIPAllAddrTable[$i][8] & @CRLF & _ ", [9] Max Receive Speed [Vista+] = " & $aIPAllAddrTable[$i][9] & _ ", [10] Max Transmit Speed [Vista+] = " & $aIPAllAddrTable[$i][10] & @CRLF & _ ", [11] IPv4 Address(es): "& $aIPAllAddrTable[$i][11] & _ ", [12] IPv6 Address(es): "& $aIPAllAddrTable[$i][12] & @CRLF & _ ", [13] DNS IPv4 Address(es): "& $aIPAllAddrTable[$i][13] & _ ", [14] DNS IPv6 Address(es): "& $aIPAllAddrTable[$i][14] & @CRLF & _ ", [15] Gateway IPv4 Address(es) [Vista+]: "& $aIPAllAddrTable[$i][15] & _ ", [16] Gateway IPv6 Address(es) [Vista+]: "& $aIPAllAddrTable[$i][16] & @CRLF & _ ", [17] DHCP IPv4 Address(es) [Vista+]: "& $aIPAllAddrTable[$i][17] & _ ", [18] DHCP IPv6 Address(es) [Vista+]: "& $aIPAllAddrTable[$i][18] & @CRLF & _ ", [19] WINS IPv4 Address(es) [Vista+]: "& $aIPAllAddrTable[$i][19] & _ ", [20] WINS IPv6 Address(es) [Vista+]: "& $aIPAllAddrTable[$i][20] & @CRLF & _ ", [21] Connection Type [Vista+] = " & $aIPAllAddrTable[$i][21] & _ ", [22] Tunnel Type [Vista+] = " & $aIPAllAddrTable[$i][22] & @CRLF) ; Interface Statistics & Info for Given index $aNIEntryInfo = _Network_InterfaceEntryInfo($aIPAllAddrTable[$i][0]) ;~ ConsoleWrite("_Network_InterfaceEntryInfo return, @error = " & @error & ", @extended = " & @extended & @CRLF) 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($sSeparator & @CRLF) Next $hSplash=SplashTextOn("Network Usage Information", "", 520, 24 + (19 * 15) + ($nInterfaces * (5.5 * 15)), Default, Default, 16+4, "Lucida Console", 11) ; Start loop Do $aIPStats = _Network_IPStatistics() $aTCPStats = _Network_TCPStatistics() $aUDPStats = _Network_UDPStatistics() $aICMPStats = _Network_ICMPStatistics() $aIPv6Stats = _Network_IPStatistics(1) $aTCPv6Stats = _Network_TCPStatistics(1) $aUDPv6Stats = _Network_UDPStatistics(1) $aICMPv6Stats = _Network_ICMPStatistics(1) $sSplashText = StringFormat("%35s", "== TCP Stats ==") & @CRLF $sSplashText &= StringFormat("IPv4: [Segments] Recvd = %10u | Sent = %10u", $aTCPStats[9], $aTCPStats[10]) & @CRLF $sSplashText &= StringFormat("IPv6: [Segments] Recvd = %10u | Sent = %10u", $aTCPv6Stats[9], $aTCPv6Stats[10]) & @CRLF $sSplashText &= StringFormat("<Total Connections> IPv4: %10u | IPv6: %10u", $aTCPStats[14], $aTCPv6Stats[14]) & @CRLF $sSplashText &= @CRLF & StringFormat("%35s", "== UDP Stats ==") & @CRLF $sSplashText &= StringFormat("IPv4: [Datagrams] Recvd = %10u | Sent = %10u", $aUDPStats[0], $aUDPStats[3]) & @CRLF $sSplashText &= StringFormat("IPv6: [Datagrams] Recvd = %10u | Sent = %10u", $aUDPv6Stats[0], $aUDPv6Stats[3]) & @CRLF $sSplashText &= StringFormat("<Total Listeners> IPv4: %10u | IPv6: %10u", $aUDPStats[4], $aUDPv6Stats[4]) & @CRLF $sSplashText &= @CRLF & StringFormat("%35s", "== IP Stats ==") & @CRLF $sSplashText &= StringFormat("IPv4: [Datagrams] Recvd = %10u | Sent = %10u", $aIPStats[2], $aIPStats[9]) & @CRLF $sSplashText &= StringFormat("IPv6: [Datagrams] Recvd = %10u | Sent = %10u", $aIPv6Stats[2], $aIPv6Stats[9]) & @CRLF $sSplashText &= @CRLF & StringFormat("%35s", "== ICMP Stats ==") & @CRLF $sSplashText &= StringFormat("IPv4: [Messages] Recvd = %10u | Sent = %10u", $aICMPStats[0], $aICMPStats[2]) & @CRLF $sSplashText &= StringFormat("IPv6: [Messages] Recvd = %10u | Sent = %10u", $aICMPv6Stats[0], $aICMPv6Stats[2]) & @CRLF For $i = 0 To $nInterfaces - 1 ;~ $aNIEntryInfo = _Network_InterfaceEntryInfo($aIPv4AddrTable[$i][0]) ;~ $sSplashText &= @CRLF & StringFormat("%35s", "== IP " & $aIPv4AddrTable[$i][1] & " ==" ) & @CRLF $aNIEntryInfo = _Network_InterfaceEntryInfo($aIPAllAddrTable[$i][0]) If @error Then ConsoleWrite("_Network_InterfaceEntryInfo return, @error = " & @error & ", @extended = " & @extended & @CRLF) ExitLoop EndIf If $aIPAllAddrTable[$i][11] <> "" Then $sSplashText &= @CRLF & StringFormat("%40s", "== IPv4 " & $aIPAllAddrTable[$i][11] & " ==" ) & @CRLF Else $sSplashText &= @CRLF & StringFormat("%52s", "== IPv6 " & $aIPAllAddrTable[$i][12] & " ==" ) & @CRLF EndIf $sSplashText &= StringFormat("%45.56s", $aNIEntryInfo[6]) & @CRLF ; Octet *should* be the same as Bytes.. $sSplashText &= StringFormat("Data (Octets/Bytes): Recvd = %10u | Sent = %10u", $aNIEntryInfo[10], $aNIEntryInfo[16]) & @CRLF $sSplashText &= StringFormat("Unicast Packets: Recvd = %10u | Sent = %10u", $aNIEntryInfo[11], $aNIEntryInfo[17]) & @CRLF $sSplashText &= StringFormat("Non-Unicast Packets: Recvd = %10u | Sent = %10u", $aNIEntryInfo[12], $aNIEntryInfo[18]) & @CRLF Next $sSplashText &= @CRLF & StringFormat("%35s", "[ESC] Exits") & @CRLF ControlSetText($hSplash, "", "[CLASS:Static; INSTANCE:1]", $sSplashText) Sleep(500) Until $bHotKeyPressed NetworkStatistics.zip ~prev version. downloads: >100 Updates: 2013-07-11: Changed: _Network_IPv4AdaptersInfoEx() now returns all IP's (if requested) and Address Masks Fixed: WSALastError call possible crash with non-array variable Changed: _Network_IPAllAddressTable() now allows 'down' status interfaces to be returned Added: Some comments on development, info on getting additional stats in the UDF 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! 2013-07-02: Hotfix: Ipv6 indexing error 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 2013-06-20: Now covers all the 'p's - IP and ICMP now added1 point -
Open the webpage, and press F12...there is a tool to point at the IE object, which will return the source...example from the 'Select'...notice the @id = activity...so, that's how I grabbed the object. As for the functions I used, click on them to see the help file, and an explanation. <select name="activity" id="activity"> <option value="1.0">Basal Metabolic Rate</option> <option value="1.2">Little/no exercise</option> <option selected="true" value="1.375">3 times/week</option> <option value="1.4187">4 times/week</option> <option value="1.4625">5 times/week</option> <option value="1.550">5 times/week (intense)</option> <option value="1.6375">Every day</option> <option value="1.725">Every day (intense) or twice daily</option> <option value="1.9">Daily exercise + physical job</option> </select>1 point
-
basic example...the calculate will fail, since I'm not setting all required values...but this is just for demonstration of select and submit: #include <ie.au3> $oIE = _IECreate("http://www.freedieting.com/tools/calorie_calculator.htm",True) $oActivitySelect = _IEGetObjById($oIE, "activity") _IEFormElementOptionSelect($oActivitySelect,"1.2") ; Select's "Little/no exercise" $oCalculate = _IEGetObjById($oIE, "Button1") ; click calculate _IEAction($oCalculate, "click")1 point
-
JScript, Please stay out of this. M231 point
-
are you just experimenting with stdoutread or are you interested in network parameters? if you are intereste to network parameters then >also this link may be of interest: with that udf you can retrieve some network parameters in this way for example: (see comments inside the udf for details on returned values) #include <array.au3> #include "_NetworkStatistics.au3" ; get this from the following link: ; http://www.autoitscript.com/forum/topic/151920-network-interface-info-statistics-and-traffic/?p=1088781 Local $_net = _Network_IPAllAddressTable() _ArrayDisplay($_net) edit: added link1 point
-
I can't live without it. That was mine!1 point
-
Next beta 3.3.13.2 will have a minimum OS of: Windows XP SP3 Windows Server 2003 SP21 point
-
I did a lot of internal housekeeping when rewriting some of the file code especially around the wildcard code in FileCopy - might be worth double checking I've not broken anything.1 point
-
Alternative to DllStructGetData()
JScript reacted to eukalyptus for a topic
1 point -
I would say it is "only" a new style of coding with a touch of OO language fealing - not more not less. And it makes no sense to ask why not using arrays or something else. This makes the language "rich" to have many possibilities. Br, UEZ1 point
-
Heh, I meant something like this.. $foo = _FFSearch($lookfor, false, false, false) if $foo = 1 then ; rest of code.. ;o) Cor1 point
-
Alternative to DllStructGetData()
JScript reacted to eukalyptus for a topic
This "feature" was discovered by Minx and Mars (autoit.de). I like using structs as objects! #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) HotKeySet("{ESC}", "_Exit") _GDIPlus_Startup() Global $tWin = _Win_Create(0, 0, @DesktopWidth, @DesktopHeight) Global $hBrush = _GDIPlus_BrushCreateSolid(0xFF00FF00) Global $fX, $fY, $fW, $fH While Sleep(500) _GDIPlus_GraphicsClear($tWin.GFX, 0) For $i = 1 To 10 _GDIPlus_BrushSetSolidColor($hBrush, BitOR(0x80000000, BitShift(Random(0, 0xFF, 1), -16), BitShift(Random(0, 0xFF, 1), -8), Random(0, 0xFF, 1))) $fW = Random(50, 300) $fH = Random(50, 300) $fX = Random(0, @DesktopWidth - $fW) $fY = Random(0, @DesktopHeight - $fH) _GDIPlus_GraphicsFillEllipse($tWin.Gfx, $fX, $fY, $fW, $fH, $hBrush) Next _Win_Draw($tWin) WEnd Func _Win_Create($iX, $iY, $iW, $iH) Local $tWin = DllStructCreate("int X; int Y; int W; int H; hwnd Gui; hwnd DC; handle GFX; handle BMP; hwnd CDC; hwnd OBJ; int Src[2]; byte Blend[4];") $tWin.Blend(3) = 0xFF $tWin.Blend(4) = 1 $tWin.X = $iX $tWin.Y = $iY $tWin.W = $iW $tWin.H = $iH $tWin.Gui = GUICreate("", $iW, $iH, $iX, $iY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $tWin.DC = _WinAPI_GetDC($tWin.Gui) Local $hBMP = _WinAPI_CreateCompatibleBitmap($tWin.DC, $iW, $iH) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) _WinAPI_DeleteObject($hBMP) $tWin.BMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $tWin.CDC = _WinAPI_CreateCompatibleDC($tWin.DC) $tWin.OBJ = _WinAPI_SelectObject($tWin.CDC, $tWin.BMP) $tWin.GFX = _GDIPlus_GraphicsCreateFromHDC($tWin.CDC) GUISetState(@SW_SHOWNOACTIVATE, $tWin.Gui) Return $tWin EndFunc ;==>_Win_Create Func _Win_Dispose(ByRef $tWin) If Not IsDllStruct($tWin) Then Return _GDIPlus_GraphicsDispose($tWin.GFX) _WinAPI_SelectObject($tWin.CDC, $tWin.OBJ) _WinAPI_DeleteObject($tWin.BMP) _WinAPI_DeleteDC($tWin.CDC) _WinAPI_ReleaseDC($tWin.Gui, $tWin.DC) GUIDelete($tWin.Gui) $tWin = 0 EndFunc ;==>_Win_Dispose Func _Win_Draw(ByRef $tWin) If Not IsDllStruct($tWin) Then Return _WinAPI_UpdateLayeredWindow($tWin.Gui, $tWin.DC, DllStructGetPtr($tWin, "X"), DllStructGetPtr($tWin, "W"), $tWin.CDC, DllStructGetPtr($tWin, "Src"), 0, DllStructGetPtr($tWin, "Blend"), 2) EndFunc ;==>_Win_Draw Func _Exit() _GDIPlus_BrushDispose($hBrush) _Win_Dispose($tWin) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit In this example I have one struct for all things I need to draw and call _WinAPI_UpdateLayeredWindow I can add, remove or change the order of the elements without changing the rest of the script. And the code is easy to read.1 point -
Make sense pal, and you'll get an answer.1 point
-
There is no such thing as HKEY_LOCAL_MACHINE64. You have to put the right flags to RegOpenKey like KEY_WOW64_64KEY See http://msdn.microsoft.com/en-us/library/windows/desktop/ms724878(v=vs.85).aspx1 point
-
Coins & Banknotes Manager
mesale0077 reacted to Andreik for a topic
This is a new link with the old version of Coins & Banknotes Manager. And here are also some screenshots of the new version that is already done but not yet published. Main UI Tools tab Interactive map1 point -
It would be easier just making the autoit window wider than the irrlicht window, now that's it's embedded, and then use the extra space for controls like buttons, tabs etc. Then there's no need to punch holes. Something like this... #include "./Bin/au3Irrlicht2.au3" ;#include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $Gui = GUICreate("AutoIt Window", 800, 458, -1, -1) HotKeySet("{ESC}", "_exit") ;Embed Irrlicht RenderWindow--------------------------------------------------------------------------------------- _IrrStart($IRR_EDT_opengl, 640, 480, $IRR_BITS_PER_PIXEL_32, $IRR_windowed, $IRR_SHADOWS, $IRR_capture_EVENTS, $IRR_VERTICAL_SYNC_Off) _IrrSetWindowCaption( "IrrLicht Window") _WinAPI_SetWindowRgn(WinGetHandle("IrrLicht Window", ""), _WinAPI_CreateRectRgn(3, 22, 640, 480)) ; Cut off IrrLicht Window Border GUICtrlCreateButton("Hey1", 680, 40, 100, 22) GUICtrlCreateButton("Hey2", 680, 80, 100, 22) GUICtrlCreateButton("Hey3", 680, 120, 100, 22) WinMove("IrrLicht Window", "", -3, -22) _WinAPI_Setparent(WinGetHandle("IrrLicht Window", ""), $Gui) WinActivate("AutoIt Window") GUISetState() ;-------------------------------------------------------------------------------------------------------------------- ;add your IrrLicht stuff here..... WHILE _IrrRunning() _IrrBeginScene(128,128,128) _IrrDrawScene() _IrrEndScene() Sleep(5) WEND Func _exit() _IrrStop() Exit EndFunc ; _exit1 point