Leaderboard
Popular Content
Showing content with the highest reputation on 05/01/2019 in all areas
-
Hey folks, This is actually the beginnings of something else - but I was pretty happy with how this part turned out. So hey, here is a clock. it is drag-able Escape (after clicking on clock) : Exit Wheel: Grow & Shrink Click Wheel: Reset Size Edit: somehow missed an include directive... #AutoIt3Wrapper_Au3Check_Parameters = -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GDIPlus.au3> #include <GUIConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $hGUI, $iWinH, $iWinW, $iChSize, _ $iStartSz, $iMargin, $iCanvasSz, $iWinXStartPos Global Const $PI = 4 * ATan(1) Global Const $MAGIC_PINK = 0xFF00FF, $MAGIC_PINK_ARGB = 0xFFFF00FF $iWinH = @DesktopHeight $iWinW = $iWinH $iCanvasSz = $iWinH $iMargin = 4 $iStartSz = Int($iWinH / 4) - (2 * $iMargin) $iWinXStartPos = 0 ;Right Side: ide@DesktopWidth - ($iStartSz + (2 * $iMargin)) $hGUI = GUICreate("Clock", $iWinW, $iWinH, $iWinXStartPos, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetBkColor($MAGIC_PINK) _WinAPI_SetLayeredWindowAttributes($hGUI, $MAGIC_PINK, 0xF0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") GUIRegisterMsg($WM_NCMBUTTONDOWN, "WM_NCMBUTTONDOWN") Clock() Func Clock() Local $hGraphic, $hClockBitmap, $hClockGraphic Local $iSize, $iDigSize, $iOrigin Local $iNumDist, $iDigXOffset, $iDigYOffset Local $ixOffset, $iyOffset Local $hFrameBrush, $hNoseBrush, $hHighlightBrush, $hFaceBrush Local $hBlackPen, $hSecPen, $hMinPen, $hHourPen Local $iSec, $iMin, $iHour Local $ixSecOffset, $iySecOffset, $ixMinOffset, $iyMinOffset, _ $ixHourOffset, $iyHourOffset $iDigSize = $iSize / 20 $iChSize = $iStartSz _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hClockBitmap = _GDIPlus_BitmapCreateFromGraphics($iCanvasSz, $iCanvasSz, $hGraphic) $hClockGraphic = _GDIPlus_ImageGetGraphicsContext($hClockBitmap) _GDIPlus_GraphicsSetSmoothingMode($hClockGraphic, 4) $hFrameBrush = _GDIPlus_BrushCreateSolid(0xFF80BBCC) $hNoseBrush = _GDIPlus_BrushCreateSolid(0xEE778888) $hHighlightBrush = _GDIPlus_BrushCreateSolid(0x44FF00FF) $hFaceBrush = _GDIPlus_BrushCreateSolid(0xFFEEF0FF) $hSecPen = _GDIPlus_PenCreate(0xBB882255, 1) $hMinPen = _GDIPlus_PenCreate(0xBBFF8833, 4) $hHourPen = _GDIPlus_PenCreate(0xEE4488AA, 5) $hBlackPen = _GDIPlus_PenCreate(0xFF000000, 4) Do If $iSize <> $iChSize Or @SEC <> $iSec Then $iSize = $iChSize $iDigSize = $iSize / 20 $iOrigin = Int($iSize / 2) + $iMargin $iNumDist = $iSize / 2 - ($iSize / 8) $iDigXOffset = .55 * $iDigSize $iDigYOffset = -(.7 * $iDigSize) _GDIPlus_GraphicsClear($hClockGraphic, $MAGIC_PINK_ARGB) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin, $iMargin, $iSize, $iSize, $hFrameBrush) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin + 8, $iMargin + 8, $iSize - 8, $iSize - 8, $hHighlightBrush) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin + 8, $iMargin + 8, $iSize - 16, $iSize - 16, $hFaceBrush) _GDIPlus_GraphicsDrawEllipse($hClockGraphic, $iMargin, $iMargin, $iSize, $iSize, $hBlackPen) For $i = 1 To 12 $ixOffset = Int($iNumDist * Sin($i * ($PI / 6))) $iyOffset = Int($iNumDist * Cos($i * ($PI / 6))) $ixOffset -= (StringLen($i) * $iDigXOffset) $iyOffset -= $iDigYOffset _GDIPlus_GraphicsDrawString($hClockGraphic, $i, ($iOrigin + $ixOffset), ($iOrigin - $iyOffset), "Symbol", $iDigSize) Next $iSec = @SEC $iMin = 60 * @MIN + $iSec $iHour = (3600 * @HOUR) + $iMin $ixSecOffset = Int((0.83 * $iNumDist) * Sin($iSec * ($PI / 30))) $iySecOffset = Int((0.83 * $iNumDist) * Cos($iSec * ($PI / 30))) $ixMinOffset = Int((0.85 * $iNumDist) * Sin($iMin * ($PI / 1800))) $iyMinOffset = Int((0.85 * $iNumDist) * Cos($iMin * ($PI / 1800))) $ixHourOffset = Int((0.65 * $iNumDist) * Sin($iHour * ($PI / 21600))) $iyHourOffset = Int((0.65 * $iNumDist) * Cos($iHour * ($PI / 21600))) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixHourOffset, $iOrigin - $iyHourOffset, $hHourPen) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixMinOffset, $iOrigin - $iyMinOffset, $hMinPen) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixSecOffset, $iOrigin - $iySecOffset, $hSecPen) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iOrigin - 3, $iOrigin - 3, 6, 6, $hNoseBrush) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hClockBitmap, 0, 0, $iCanvasSz, $iCanvasSz) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_BrushDispose($hFrameBrush) _GDIPlus_BrushDispose($hNoseBrush) _GDIPlus_BrushDispose($hHighlightBrush) _GDIPlus_BrushDispose($hFaceBrush) _GDIPlus_PenDispose($hSecPen) _GDIPlus_PenDispose($hMinPen) _GDIPlus_PenDispose($hHourPen) _GDIPlus_PenDispose($hBlackPen) _GDIPlus_BitmapDispose($hClockBitmap) _GDIPlus_GraphicsDispose($hClockGraphic) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Clock Func WM_NCMBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam $iChSize = $iStartSz EndFunc ;==>WM_NCMBUTTONDOWN Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iWheelDist, $iRate $iRate = 0.25 $iWheelDist = BitShift($wParam, 16) $iChSize -= Int($iRate * $iWheelDist) If $iChSize < 120 Then $iChSize = 120 If $iChSize > $iCanvasSz - (2 * $iMargin) Then $iChSize = $iCanvasSz - (2 * $iMargin) EndFunc ;==>WM_MOUSEWHEEL Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST3 points
-
read the help file on _FileWriteFromArray and then adjust your script accordingly. 😇2 points
-
As the WebDriver UDF - Help & Support thread has grown too big, I started a new one. The prior thread can be found here.1 point
-
If there is no frame you could simply do : Local $sValue = _IEGetObjById ($oIE, "resultcount").innerText1 point
-
@Exit I got it working with this code : #include <Constants.au3> #include <IE.au3> #include <MsgBoxConstants.au3> Opt ("MustDeclareVars", 1) Local $oIE = _IECreate("https://www.germering-hausaerzte.de/") If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error accessing site") Local $oFrame = _IEGetObjById ($oIE, "i79leiwliframe") MsgBox ($MB_SYSTEMMODAL,"",ObjName ($oFrame)) _IENavigate ($oIE, $oFrame.getAttribute ("src")) Sleep (1500) Local $colSpans = _IETagNameGetCollection ($oIE,"span") Local $sVisitor = "" For $oSpan in $colSpans $sVisitor &= $oSpan.innerText Next MsgBox ($MB_SYSTEMMODAL,"",$sVisitor)1 point
-
ControlClick doesn't work
Earthshine reacted to basictheprogram for a topic
#AutoIt3Wrapper_Compression=3 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #RequireAdmin #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include 'log4a.au3' #include 'WaitForControls.au3' Global $TD_BTN_NEXT = '&Next >' Global $TD_BTN_INSTALL = '&Install' Global $TD_BTN_INSTALL2 = 'Install' Global $TD_BTN_FINISH = '&Finish' Global $TD_BTN_CANCEL = 'Cancel' Global $TD_BTN_IAGREE = "I &accept the terms in the license agreement" Global $TD_BTN_ALTFINISH = '&Finish' Global $TD_BTN_ALLOW_ACCESS = '&Allow access' Global $TD_BTN_REMOVE = '&Remove' Global $TD_BTN_YES = '&Yes' Global $TD_BTN_OK = 'OK' Global $TD_BTN_TYPICAL = '&Typical' Global $TD_EDIT_DATA = '99999' Global $TD_TREE_NAME = 'Tree1' Global $apptext = 'EasyLog USB Device Driver Installer' Global $text = "EasyLog USB - InstallShield Wizard" Global $class = "[CLASS:MsiDialogCloseClass]" Global $stdClass = '[Class:#32770]' Global $button1 = "[CLASS:Button; INSTANCE:1]" Global $button2 = "[CLASS:Button; INSTANCE:2]" Global $button3 = "[CLASS:Button; INSTANCE:3]" Global $button4 = "[CLASS:Button; INSTANCE:4]" Global $button5 = "[CLASS:Button; INSTANCE:5]" #Region ;**** Logging **** ; Enable logging and don't write to stderr _log4a_SetEnable() ; Write to stderr, set min level to warn, customize message format _log4a_SetErrorStream() _log4a_SetCompiledOutput($LOG4A_OUTPUT_FILE) _log4a_SetMinLevel($LOG4A_LEVEL_DEBUG) ; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled _log4a_SetFormat("${date} | ${host} | ${level} | ${message}") #EndRegion ;**** Logging **** Func Install() Local $handle = WinActivate($text) _log4a_Info($handle) _log4a_Info('Begin Install()') _checkClickCtrl($class, $text, $button1, $TD_BTN_NEXT, 0) _checkClickCtrl($class, $text, $button3, $TD_BTN_IAGREE, 0) _checkClickCtrl($class, $text, $button5, $TD_BTN_NEXT, 0) _checkClickCtrl($class, $text, $button1, $TD_BTN_INSTALL, 0) _checkClickCtrl($class, $text, $button1, $TD_BTN_FINISH, 0) _checkClickCtrl($stdClass, $apptext, $button1, $TD_BTN_INSTALL2, 0) _checkClickCtrl($stdClass, 'Success', $button1, $TD_BTN_OK, 0, 3) _log4a_Info('End Install()') EndFunc Install() The above code does not work for me 😞 The device driver dialog remains in the screen and the install doesn't finish. Does this video I made help? Gladly look for donuts for you 🙂1 point -
RdpRunner
argumentum reacted to BigDaddyO for a file
1 point -
in same article you can read this is true for 1 build but not neccesarily for next (nightly) build. Close collaboration with developers is needed to have accessibility identification with any property. If you treat the app as a black box then in one case title,class is unique and in others you need more. Feel free to modify simplespy to your need.1 point
-
PDF to Excel
Earthshine reacted to Bert for a topic
so let me get this right - you don't want third party software, yet AutoIt is third party software. You wanted an expert. Hello - that be me and I've performed the procedure of converting of PDF to xls files MANY TIMES. And you ignored completely what I said for you already made up your mind on what the solution is. Seeing how you are insistent on your course of action and are being thick about it - I'm out.1 point -
This is no longer the correct syntax. It's now "goog:chromeOptions". Check out wd_demo script for the correct usage.1 point
-
PDF to Excel
Earthshine reacted to Bert for a topic
use excel and open the PDF. save as and change to the file type you want. Most likely won't work1 point -
@Danp2 Why you let me resolve it ? @FrancescoDiMuro Why do like what danp2 has said ? And at @Pkillerjd seems you don't want to invest in searching : Local $colLabels = _IETagNameGetCollection ($oIE,"label") For $oLabel in $colLabels MsgBox ($MB_SYSTEMMODAL,"",$oLabel.getAttribute("for") & "/" & $oLabel.innerText) Next1 point
-
Hi guys, there is no UDF wrappers for GetAdaptersAddresses API... till now Here you are: ; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_GetAdaptersAddresses ; Description ...: Retrieves the addresses associated with the adapters on the local computer. ; Syntax.........: _WinAPI_GetAdaptersAddresses($iFamily = 2, $iShowAll = 1, $iShowTunnel = 0) ; Parameters ....: $iFamily - IP type. ; |0 - Both ; |2 - IPv4 (default) ; |23 - IPv6 ; $iShowAll - Presentation mode ; |0 - Short: only Unicast address(es) and Friendly Name columns are returned ; |1 - Long (default): all columns are returned but Anycast and Multicast columns return only the first address (it is not an array) ; |2 - Complete: all columns are returned, Anycast and Multicast columns return an array with the complete list of addresses ; $iShowTunnel - Shows or not tunnel interfaces ; |0 - Don't show (default) ; |1 - Show ; Return values .: On success it returns a bidimensional array: on rows there is the adapter list, these are the columns ; |0 - Preferred unicast address(es), it returns an array of addresses only if $iFamily == 0 ; |1 - Friendly name ; |2 - Anycast addresses: if $iShowAll == 1 it returns the first anycast address of the list, ; if $iShowAll == 2 it returns an array with the complete list of anycast addresses ; |3 - Multicast addresses: if $iShowAll == 1 it returns the first multicast address of the list, ; if $iShowAll == 2 it returns an array with the complete list of multicast addresses ; |4 - DNS Server 1 address ; |5 - DNS Server 2 address ; |6 - Adapter Name ; |7 - Description ; |8 - MAC address ; |9 - Interface Type ; for example $array[2][8] represents the MAC address of the third adapter ; ; On failure it returns 0 and sets @error to non zero (these values are useful only for debugging reasons): ; |1 - incorrect parameters ; |2 - DllOpen error ; |3 - DllCall error ; |4 - _WinAPI_GetString error ; |5 - Query for IPv6 addresses and IPv6 is not installed on the OS ; Author ........: j0kky ; Modified ......: 1.1.3 13/02/15 ; Remarks .......: This function is fully compatible with all OS from Windows XP onwards, there can be some problem using this function ; with $iFamily == 23 if the OS is prior to Windows XP SP1 ; Link ..........: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915(v=vs.85).aspx ; =============================================================================================================================== #include <WinAPIMisc.au3> Func _WinAPI_GetAdaptersAddresses($iFamily = 2, $iShowAll = 1, $iShowTunnel = 0) If Not ($iFamily == 0 Or $iFamily == 2 Or $iFamily == 23) Or _ Not ($iShowAll == 0 Or $iShowAll == 1 Or $iShowAll == 2) Or _ Not ($iShowTunnel == 0 Or $iShowTunnel == 1) Then Return SetError(1, 0, 0) Local $aRet If $iFamily == 23 Then $aRet = DllCall("Ws2_32.dll", "int", "WSCEnumProtocols", "ptr", Null, "ptr", Null, "dword*", Null, "ptr", Null) Local $tlpProtocolBuffer = DllStructCreate("byte[" & $aRet[3] & "]") Local $plpProtocolBuffer = DllStructGetPtr($tlpProtocolBuffer) $aRet = DllCall("Ws2_32.dll", "int", "WSCEnumProtocols", "ptr", Null, "ptr", $plpProtocolBuffer, "dword*", $aRet[3], "ptr", Null) Local $tagWSAPROTOCOL_INFOW = "dword dwServiceFlags1; dword dwServiceFlags2; dword dwServiceFlags3; dword dwServiceFlags4; dword dwServiceFlags5; byte ProviderId[16]; " & _ "dword dwCatalogEntryId; " & _ "STRUCT; int ChainLen; dword ChainEntries[7]; ENDSTRUCT;" & _ ;ProtocolChain "int iVersion; int iAddressFamily; int iMaxSockAddr; int iMinSockAddr; int iSocketType; int iProtocol; int iProtocolMaxOffset; int iNetworkByteOrder; " & _ "int iSecurityScheme; dword dwMessageSize; dword dwProviderReserved; wchar szProtocol[256]" Local $tWSAPROTOCOL_INFOW, $size For $i = 0 To $aRet[0] - 1 If $i == 0 Then $tWSAPROTOCOL_INFOW = DllStructCreate($tagWSAPROTOCOL_INFOW, $plpProtocolBuffer) Else $tWSAPROTOCOL_INFOW = DllStructCreate($tagWSAPROTOCOL_INFOW, $plpProtocolBuffer + $size) EndIf If DllStructGetData($tWSAPROTOCOL_INFOW, "iAddressFamily") == 23 Then ExitLoop If $i == ($aRet[0] - 1) Then Return SetError(5, 0, 0) ;if IPv6 is not installed on the system $size += DllStructGetSize($tWSAPROTOCOL_INFOW) Next EndIf $hIphlpapi = DllOpen("Iphlpapi.dll") If @error Then Return SetError(2, 0, 0) $aRet = DllCall($hIphlpapi, "ULONG", "GetAdaptersAddresses", "ULONG", $iFamily, "ULONG", 0, "ptr", Null, "ptr", Null, "dword*", 0) If @error Then DllClose($hIphlpapi) Return SetError(3, 0, 0) EndIf Local $tbuffer_AdapterAddresses = DllStructCreate("byte[" & $aRet[5] & "]") Local $pbuffer_AdapterAddresses = DllStructGetPtr($tbuffer_AdapterAddresses) DllCall($hIphlpapi, "ULONG", "GetAdaptersAddresses", "ULONG", $iFamily, "ULONG", 0, "ptr", Null, "ptr", $pbuffer_AdapterAddresses, "dword*", $aRet[5]) If @error Then DllClose($hIphlpapi) Return SetError(3, 0, 0) EndIf DllClose($hIphlpapi) Local Const $tagIP_ADAPTER_ADDRESSES = "ulong Length; dword IfIndex; ptr Next; ptr AdapterName; ptr FirstUnicastAddress; ptr FirstAnycastAddress; " & _ "ptr FirstMulticastAddress; ptr FirstDnsServerAddress; ptr DnsSuffix; ptr Description; ptr FriendlyName; byte PhysicalAddress[8]; dword PhysicalAddressLength; " & _ "dword Flags; dword Mtu; dword IfType; int OperStatus" ;valid on Windows XP #cs "dword Ipv6IfIndex; dword ZoneIndices[16]; ptr FirstPrefix; " & _ ;added on WinXP SP1 "uint64 TransmitLinkSpeed; uint64 ReceiveLinkSpeed; ptr FirstWinsServerAddress; ptr FirstGatewayAddress; ulong Ipv4Metric; ulong Ipv6Metric; uint64 Luid; " & _ "STRUCT; ptr Dhcpv4ServerlpSockaddr; int Dhcpv4ServeriSockaddrLength; ENDSTRUCT; " & _ ;Dhcpv4Server "uint CompartmentId; byte NetworkGuid[16]; int ConnectionType; int TunnelType; " & _ "STRUCT; ptr Dhcpv6ServerlpSockaddr; int Dhcpv6ServeriSockaddrLength; ENDSTRUCT; " & _ ;Dhcpv6Server "byte Dhcpv6ClientDuid[130]; ulong Dhcpv6ClientDuidLength; ulong Dhcpv6Iaid; " & _ ;added on WinVista "ptr FirstDnsSuffix" ;added on WinVista SP1 #ce Local Const $tagIP_ADAPTER_UNICAST_ADDRESS = "ulong Length; dword Flags; ptr Next; " & _ "STRUCT; ptr AddresslpSockaddr; int AddressiSockaddrLength; ENDSTRUCT; " & _ ;Address "int PrefixOrigin; int SuffixOrigin; int DadState; ulong ValidLifetime; ulong PreferredLifetime; ulong LeaseLifetime" #cs "byte OnLinkPrefixLength" ;added on WinVista #ce Local $tIP_ADAPTER_ADDRESSES = DllStructCreate($tagIP_ADAPTER_ADDRESSES, $pbuffer_AdapterAddresses) Local $nAdapter = 0, $pUnicastAddress, $tIP_ADAPTER_UNICAST_ADDRESS, $plpSockaddr, $iSockaddrLength, $tbuffer_lpszAddressString, $pbuffer_lpszAddressString Local Const $IfOperStatusUp = 1, $IF_TYPE_SOFTWARE_LOOPBACK = 24, $IF_TYPE_TUNNEL = 131, $IpDadStatePreferred = 4, $pNull = Ptr(0) If $iShowAll Then Local $nColumns = 10 Local Const $tagIP_ADAPTER_ANYCAST_ADDRESS = "ulong Length; dword Flags; ptr Next; " & _ "STRUCT; ptr AddresslpSockaddr; int AddressiSockaddrLength; ENDSTRUCT" ;Address Local Const $tagIP_ADAPTER_MULTICAST_ADDRESS = $tagIP_ADAPTER_ANYCAST_ADDRESS Local Const $tagIP_ADAPTER_DNS_SERVER_ADDRESS = "ulong Length; dword Reserved; ptr Next; " & _ "STRUCT; ptr AddresslpSockaddr; int AddressiSockaddrLength; ENDSTRUCT" ;Address Local $pAnycastAddress, $tIP_ADAPTER_ANYCAST_ADDRESS, $pMulticastAddress, $tIP_ADAPTER_MULTICAST_ADDRESS, $pDnsServerAddress, $tADAPTER_DNS_SERVER_ADDRESS, $sMAC Local Const $IF_TYPE_ETHERNET_CSMACD = 6, $IF_TYPE_IEEE80211 = 71, $IF_TYPE_IEEE1394 = 144 Else Local $nColumns = 2 EndIf Local $aResult[$nAdapter][$nColumns] $hWs2_32 = DllOpen("Ws2_32.dll") If @error Then Return SetError(2, 0, 0) TCPStartup() Do If DllStructGetData($tIP_ADAPTER_ADDRESSES, "OperStatus") == $IfOperStatusUp And _ Not (DllStructGetData($tIP_ADAPTER_ADDRESSES, "IfType") == $IF_TYPE_SOFTWARE_LOOPBACK) And _ (Not (DllStructGetData($tIP_ADAPTER_ADDRESSES, "IfType") == $IF_TYPE_TUNNEL) Or $iShowTunnel) Then ;if it's connected and it is not a loopback and it is a tunnel interface (only if $iShowTunnel == 1) $nAdapter += 1 ReDim $aResult[$nAdapter][$nColumns] ;Unicast address(es) $pUnicastAddress = DllStructGetData($tIP_ADAPTER_ADDRESSES, "FirstUnicastAddress") $tIP_ADAPTER_UNICAST_ADDRESS = DllStructCreate($tagIP_ADAPTER_UNICAST_ADDRESS, $pUnicastAddress) If Not $iFamily Then Local $aAddresses[0], $iCounter = -1 Do ;write the PREFERRED address for this adapter, it writes both IPV4 and IPV6 preferred addresses in an array if $iFamily == 0 If DllStructGetData($tIP_ADAPTER_UNICAST_ADDRESS, "DadState") == $IpDadStatePreferred Then $plpSockaddr = DllStructGetData($tIP_ADAPTER_UNICAST_ADDRESS, "AddresslpSockaddr") $iSockaddrLength = DllStructGetData($tIP_ADAPTER_UNICAST_ADDRESS, "AddressiSockaddrLength") $aRet = DllCall($hWs2_32, "int", "WSAAddressToString", "ptr", $plpSockaddr, "int", $iSockaddrLength, "ptr", Null, "byte*", Null, "dword*", 0) If @error Then DllClose($hWs2_32) Return SetError(3, 0, 0) EndIf $tbuffer_lpszAddressString = DllStructCreate("wchar[" & $aRet[5] & "]") $pbuffer_lpszAddressString = DllStructGetPtr($tbuffer_lpszAddressString) $aRet = DllCall($hWs2_32, "int", "WSAAddressToStringW", "ptr", $plpSockaddr, "int", $iSockaddrLength, "ptr", Null, "ptr", $pbuffer_lpszAddressString, "dword*", $aRet[5]) If @error Then DllClose($hWs2_32) Return SetError(3, 0, 0) EndIf If $iFamily Then $aResult[$nAdapter - 1][0] = _WinAPI_GetString($pbuffer_lpszAddressString) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf ExitLoop Else $iCounter = UBound($aAddresses) ReDim $aAddresses[$iCounter + 1] $aAddresses[$iCounter] = _WinAPI_GetString($pbuffer_lpszAddressString) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf EndIf EndIf $pUnicastAddress = DllStructGetData($tIP_ADAPTER_UNICAST_ADDRESS, "Next") If Not ($pUnicastAddress == $pNull) Then $tIP_ADAPTER_UNICAST_ADDRESS = DllStructCreate($tagIP_ADAPTER_UNICAST_ADDRESS, $pUnicastAddress) EndIf Until $pUnicastAddress == $pNull If Not $iFamily Then If $iCounter < 0 Then ReDim $aAddresses[1] ;if there is no preferred unicast addresses for this adapter, I don't know if it can happens $aResult[$nAdapter - 1][0] = $aAddresses EndIf ;FriendlyName $aResult[$nAdapter - 1][1] = _WinAPI_GetString(DllStructGetData($tIP_ADAPTER_ADDRESSES, "FriendlyName")) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf If $iShowAll Then ;Anycast address, it shows only the first one if $iShowAll == 1 $pAnycastAddress = DllStructGetData($tIP_ADAPTER_ADDRESSES, "FirstAnycastAddress") If Not ($pAnycastAddress == $pNull) Then $tIP_ADAPTER_ANYCAST_ADDRESS = DllStructCreate($tagIP_ADAPTER_ANYCAST_ADDRESS, $pAnycastAddress) If $iShowAll == 2 Then Local $aAddresses[0] While $pMulticastAddress <> $pNull $plpSockaddr = DllStructGetData($tIP_ADAPTER_ANYCAST_ADDRESS, "AddresslpSockaddr") $iSockaddrLength = DllStructGetData($tIP_ADAPTER_ANYCAST_ADDRESS, "AddressiSockaddrLength") $aRet = DllCall($hWs2_32, "int", "WSAAddressToString", "ptr", $plpSockaddr, "int", $iSockaddrLength, "ptr", Null, "byte*", Null, "dword*", 0) If @error Then DllClose($hWs2_32) Return SetError(3, 0, 0) EndIf $tbuffer_lpszAddressString = DllStructCreate("wchar[" & $aRet[5] & "]") $pbuffer_lpszAddressString = DllStructGetPtr($tbuffer_lpszAddressString) $aRet = DllCall($hWs2_32, "int", "WSAAddressToStringW", "ptr", $plpSockaddr, "int", $iSockaddrLength, "ptr", Null, "ptr", $pbuffer_lpszAddressString, "dword*", $aRet[5]) If @error Then DllClose($hWs2_32) Return SetError(3, 0, 0) EndIf If $iShowAll == 2 Then $iCounter = UBound($aAddresses) ReDim $aAddresses[$iCounter + 1] $aAddresses[$iCounter] = _WinAPI_GetString($pbuffer_lpszAddressString) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf Else $aResult[$nAdapter - 1][2] = _WinAPI_GetString($pbuffer_lpszAddressString) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf ExitLoop EndIf $pAnycastAddress = DllStructGetData($tIP_ADAPTER_ANYCAST_ADDRESS, "Next") If Not ($pAnycastAddress == $pNull) Then $tIP_ADAPTER_ANYCAST_ADDRESS = DllStructCreate($tagIP_ADAPTER_ANYCAST_ADDRESS, $pAnycastAddress) EndIf WEnd If $iShowAll == 2 Then If $aAddresses[0] Then $aResult[$nAdapter - 1][2] = $aAddresses EndIf EndIf ;Multicast address, it shows only the first one if $iShowAll == 1 $pMulticastAddress = DllStructGetData($tIP_ADAPTER_ADDRESSES, "FirstMulticastAddress") If Not ($pMulticastAddress == $pNull) Then $tIP_ADAPTER_MULTICAST_ADDRESS = DllStructCreate($tagIP_ADAPTER_MULTICAST_ADDRESS, $pMulticastAddress) If $iShowAll == 2 Then Local $aAddresses[0] While $pMulticastAddress <> $pNull $plpSockaddr = DllStructGetData($tIP_ADAPTER_MULTICAST_ADDRESS, "AddresslpSockaddr") $iSockaddrLength = DllStructGetData($tIP_ADAPTER_MULTICAST_ADDRESS, "AddressiSockaddrLength") $aRet = DllCall($hWs2_32, "int", "WSAAddressToString", "ptr", $plpSockaddr, "int", $iSockaddrLength, "ptr", Null, "byte*", Null, "dword*", 0) If @error Then DllClose($hWs2_32) Return SetError(3, 0, 0) EndIf $tbuffer_lpszAddressString = DllStructCreate("wchar[" & $aRet[5] & "]") $pbuffer_lpszAddressString = DllStructGetPtr($tbuffer_lpszAddressString) $aRet = DllCall($hWs2_32, "int", "WSAAddressToStringW", "ptr", $plpSockaddr, "int", $iSockaddrLength, "ptr", Null, "ptr", $pbuffer_lpszAddressString, "dword*", $aRet[5]) If @error Then DllClose($hWs2_32) Return SetError(3, 0, 0) EndIf If $iShowAll == 2 Then $iCounter = UBound($aAddresses) ReDim $aAddresses[$iCounter + 1] $aAddresses[$iCounter] = _WinAPI_GetString($pbuffer_lpszAddressString) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf Else $aResult[$nAdapter - 1][3] = _WinAPI_GetString($pbuffer_lpszAddressString) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf ExitLoop EndIf $pMulticastAddress = DllStructGetData($tIP_ADAPTER_MULTICAST_ADDRESS, "Next") If Not ($pMulticastAddress == $pNull) Then $tIP_ADAPTER_MULTICAST_ADDRESS = DllStructCreate($tagIP_ADAPTER_MULTICAST_ADDRESS, $pMulticastAddress) EndIf WEnd If $iShowAll == 2 Then If $aAddresses[0] Then $aResult[$nAdapter - 1][3] = $aAddresses EndIf EndIf ;DnsServer 1 and 2 $pDnsServerAddress = DllStructGetData($tIP_ADAPTER_ADDRESSES, "FirstDnsServerAddress") If Not ($pDnsServerAddress == $pNull) Then $tADAPTER_DNS_SERVER_ADDRESS = DllStructCreate($tagIP_ADAPTER_DNS_SERVER_ADDRESS, $pDnsServerAddress) For $iCounter = 4 To 5 $plpSockaddr = DllStructGetData($tADAPTER_DNS_SERVER_ADDRESS, "AddresslpSockaddr") $iSockaddrLength = DllStructGetData($tADAPTER_DNS_SERVER_ADDRESS, "AddressiSockaddrLength") $aRet = DllCall($hWs2_32, "int", "WSAAddressToString", "ptr", $plpSockaddr, "int", $iSockaddrLength, "ptr", Null, "byte*", Null, "dword*", 0) If @error Then DllClose($hWs2_32) Return SetError(3, 0, 0) EndIf $tbuffer_lpszAddressString = DllStructCreate("wchar[" & $aRet[5] & "]") $pbuffer_lpszAddressString = DllStructGetPtr($tbuffer_lpszAddressString) $aRet = DllCall($hWs2_32, "int", "WSAAddressToStringW", "ptr", $plpSockaddr, "int", $iSockaddrLength, "ptr", Null, "ptr", $pbuffer_lpszAddressString, "dword*", $aRet[5]) If @error Then DllClose($hWs2_32) Return SetError(3, 0, 0) EndIf $aResult[$nAdapter - 1][$iCounter] = _WinAPI_GetString($pbuffer_lpszAddressString) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf $pDnsServerAddress = DllStructGetData($tADAPTER_DNS_SERVER_ADDRESS, "Next") If Not ($pDnsServerAddress == $pNull) Then $tADAPTER_DNS_SERVER_ADDRESS = DllStructCreate($tagIP_ADAPTER_DNS_SERVER_ADDRESS, $pDnsServerAddress) Else ExitLoop EndIf Next EndIf ;AdapterName $aResult[$nAdapter - 1][6] = _WinAPI_GetString(DllStructGetData($tIP_ADAPTER_ADDRESSES, "AdapterName"), False) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf ;Description $aResult[$nAdapter - 1][7] = _WinAPI_GetString(DllStructGetData($tIP_ADAPTER_ADDRESSES, "Description")) If @error And @error <> 10 Then DllClose($hWs2_32) Return SetError(4, 0, 0) EndIf ;MAC $sMAC = String(DllStructGetData($tIP_ADAPTER_ADDRESSES, "PhysicalAddress")) $aResult[$nAdapter - 1][8] = StringRegExpReplace( _ StringTrimRight(StringTrimLeft($sMAC, 2), _ ;0x StringLen($sMAC) - ((DllStructGetData($tIP_ADAPTER_ADDRESSES, "PhysicalAddressLength") * 2) + 2)), _ "(.{2})(?!$)", "$1-") ;from 0xG4V4B5B4V2N2000000 to G4-V4-B5-B4-V2-N2 ;IfType Switch DllStructGetData($tIP_ADAPTER_ADDRESSES, "IfType") Case $IF_TYPE_ETHERNET_CSMACD Switch @OSVersion Case "WIN_XP", "WIN_XPe", "WIN_2003" $aResult[$nAdapter - 1][9] = "Ethernet or wireless network interface" Case Else $aResult[$nAdapter - 1][9] = "Ethernet network interface" EndSwitch Case $IF_TYPE_IEEE80211 $aResult[$nAdapter - 1][9] = "Wireless network interface" Case $IF_TYPE_TUNNEL $aResult[$nAdapter - 1][9] = "Tunnel type encapsulation network interface" Case $IF_TYPE_IEEE1394 $aResult[$nAdapter - 1][9] = "Firewire network interface" Case Else $aResult[$nAdapter - 1][9] = "Other type of network interface" EndSwitch EndIf EndIf $pbuffer_AdapterAddresses = DllStructGetData($tIP_ADAPTER_ADDRESSES, "Next") If Not ($pbuffer_AdapterAddresses == $pNull) Then $tIP_ADAPTER_ADDRESSES = DllStructCreate($tagIP_ADAPTER_ADDRESSES, $pbuffer_AdapterAddresses) EndIf Until $pbuffer_AdapterAddresses == $pNull TCPShutdown() DllClose($hWs2_32) Return $aResult EndFunc ;==>_WinAPI_GetAdaptersAddresses It is really useful because it can retrieve all informations needed for every adapters and it works with IPv6 too (opposite of GetAdaptersInfo, that supports only IPv4). I've made it compatible with every OS (from Windows XP). Test it and report any bug in this topic, please! I've attached an example about how it can be used, enjoy it EDIT: Last UDF version: 13th February 2015 GetAdaptersAddresses.au31 point
-
send text to empty cell in Excel
Earthshine reacted to JLogan3o13 for a topic
@all, we all understand the issues this particular user is causing, and will be dealing with it from a Moderation standpoint. If you are (rightly) frustrated, please just pass the post by rather than arguing, per the forum rules. Lack of responses is going to be more of an incentive to provide more information than the insults.1 point -
Because the data hasn't finished refreshing. Add a Sleep command or use the delay option of _IELoadWait.1 point
-
You can use the id of the tab directly with something like this : $oTag = _IEGetObjById ($oIE, "ctl00_MainContent_ucViewControl_IntegratedFedWatchTool_uccv_lvMeetings_ctrl1_lbMeeting") _IEAction ($oTag, "click") _IELoadWait ($oIE) Each tab has its own number if you look carefully the ids...1 point
-
Will Associative Arrays be coming?
FrancescoDiMuro reacted to TheDcoder for a topic
That is perfectly fine and acceptable, if you have the technical know-how and are willing to put in effort to write code with fewer layers, then that is a good thing in any imaginable way. But that is not my point at all! Using the raw implementation is often not that easy, especially for beginners. And since how AutoIt is meant to be a simple language, it is natural for it to have many wrapping functions, just look at the huge library of WinAPI UDFs. Most of those implementations are not optimized, but what they lack in performance make up in ease of use Most of the time the average AutoIt coder would look at how to accomplish a certain task, rather on how to accomplish it in the most efficient way using the direct APIs In my opinion, the AutoIt community largely owns up to the amount of UDFs it has. That is one of the beauties of the language, it is easily extensible. I am not contesting this fact I gracefully disagree, it is what you make of it. Beauty is what you make of it, if you can write code which is easy to understand and is very organized, then it is beautiful in that manner. UDFs help achieve that by wrapping "dirty" functions calls (especially DllCall) into a consistent set of functions1 point -
Filewrite($file,@crlf)-or- Filewriteline($file,"")1 point
-
While 1 $msg = GUIGetMsg() Select Case $msg = $startButton MsgBox(0, "GUI Event", "You pressed start button!") $timestamp = TimerInit() ;start timer While 1 $msg = GUIGetMsg() If $msg = $stopButton Then ExitLoop If TimerDiff($timestamp) > 10000 Then ;adjust this for your pause MsgBox(0, "", "10 seconds passed") ;YOUR STUFF HERE $timestamp = TimerInit() ;reset the timer EndIf WEnd MsgBox(0, "GUI Event", "You pressed stop button!") Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") ExitLoop EndSelect WEnd edit - better solution1 point