Jump to content

Recommended Posts

Posted (edited)

This UDF is still only community string stuff, so just SNMPv1 and SNMPv2c for now.
V3 is not supported by this UDF, and I also haven't looked at v2 Traps.

The basic workflow is:

  1. Call the startup func
  2. Register a function to recieve incoming messages. (basically to recieve decoded OID/Value pairs.)
    • or if you cant be bothered, an internal one will just write to the console!
  3. Open a device
  4. start querying devices and stuff

The zip file attached has a bunch of demos scripts etc. to get you going.

But here's an example script for post #1 anyhow.

#include "SNMPv2.au3"

;--------------------------------------------------
Local $sIPAddress = "10.0.0.5" ;Device
$__g_bRetTicksAsStr = True     ;Return TimeTicks as human readable string (instead of int)
 ;There are few global params for now that you can set. - Check the demo scripts for details.
;--------------------------------------------------

Global Const $sOID_sysDescr =  "1.3.6.1.2.1.1.1.0"
Global Const $sOID_sysName =  "1.3.6.1.2.1.1.5.0"
Global Const $sOID_sysLocation = "1.3.6.1.2.1.1.6.0"
Global Const $sOID_sysUpTime = "1.3.6.1.2.1.1.3.0"

Global $mOIDLabMap[]
$mOIDLabMap[$sOID_sysDescr] = "sysDescr"
$mOIDLabMap[$sOID_sysName] = "sysName"
$mOIDLabMap[$sOID_sysLocation] = "sysLocation"
$mOIDLabMap[$sOID_sysUpTime] = "sysUpTime"

; Startup and register a handler for incoming messages.
; The function must accept 4 parameters - more on this futher down
_SNMP_Startup("_CustomMsgHandler")

;Open device
Local $iDevice = _SNMP_OpenDevice($sIPAddress)

;Get one specfic property. 
;The community param is optional. (defaults to "public") 
_SNMP_GetRequest($iDevice, $sOID_sysDescr, "public")

;Or get multiple properties in one request.
Local $aOids[3]
$aOids[0] = $sOID_sysName
$aOids[1] = $sOID_sysLocation
$aOids[2] = $sOID_sysUpTime
_SNMP_GetRequest($iDevice, $aOids)

;Temporarily keep the script alive!
Sleep(500)

;Cleanup
_SNMP_CloseDevice($iDevice)
_SNMP_Shutdown()

; Handler Params:
;  $iDevice      - device that responded
;  $dPacket      - rawData
;  $avHeader     - metadata pulled from the response.          Format: $array[6][2]  (field, data)
;  $avVarBinds   - list of OID's and their associated data.    Format: $array[n][6]  (OID, Type, Value, RawType, RawValue)
;  header feilds - "SNMP Version", "Community", "Request Index", "Error Message", "Error Code", "Error Index"

Func _CustomMsgHandler($iDevice, $dRawPacket, $avHeaders, $avVarBinds)
    Local $sFeild, $vData

    For $i = 0 To UBound($avVarBinds) - 1

        ; $avVarBinds[index][OID, Type, Value, RawType, RawValue]
        $sFeild = $mOIDLabMap[$avVarBinds[$i][0]]
        $vData = $avVarBinds[$i][2]

        ConsoleWrite(StringFormat("%15s: %s\r\n",  $sFeild, $vData))
    Next
EndFunc

 

 

SNMPv2c_1.1.zip

Edited by MattyD
  • MattyD changed the title to SNMP UDF rewrite
Posted

Hi all,

Just updated the attachment - its a small internal change that helps settle things down if you're opening/closing multiple devices. :)

Also we also now have funcs to set the internal parameters.

_SNMP_SetMaxPacketLen(4096)    ; Maximum SNMP packet size / msg buffer size.
_SNMP_SetSNMPVersion(2)        ; 1 or 2 is supported. (but you'll probably want 2)
_SNMP_SetAdlibInterval(125)    ; Listen/response polling interval.
_SNMP_RetPrintSafeStr(True)    ; Non-printing characters are replaced with "." if the OID datatype is a string. (whitespace chars are retained)
_SNMP_RetTicksAsStr(False)     ; TimeTicks are returned as a human readable string if true. Otherwise an integer is returned (100ths of a second).

And here's a demo script that scans a subnet for printers, and reports on supplies to boot!

#include "..\SNMPv2.au3"
#include <GuiConstants.au3>

;--------------------------------------------------
;Network to scan..
Global $sNetAddress = "10.0.0.0"
Global $sNetMask = "255.255.255.0"

Global $iTimeout = 250          ; Time to wait for SNMP response + processing time (ms)...
Global $iBatchSize = 50         ; Max number of OIDs to return in one hit.
Global $sCommunity = "public"
; If you start losing packets with high batch sizes, try increasing $__g_iMaxPktLen.

;More UDF Params...
;--------------------------------------------------
_SNMP_SetMaxPacketLen(4096)    ; Maximum SNMP packet size / msg buffer size.
_SNMP_SetSNMPVersion(2)        ; must be 2 for GetBulk to work..
_SNMP_SetAdlibInterval(125)    ; Listen/response polling interval. (don't go too low, it can lockup your script!)
_SNMP_RetPrintSafeStr(True)    ; Non-printing characters are replaced with "." if the OID datatype is a string. (whitespace chars are retained)
_SNMP_RetTicksAsStr(True)      ; Return human readable times.
;--------------------------------------------------

Global Const $sOID_sysLocation = "1.3.6.1.2.1.1.6"

Global Const $sOID_hrDeviceTable = "1.3.6.1.2.1.25.3.2"
Global Const $sOID_hrDeviceTableEntry = "1.3.6.1.2.1.25.3.2.1"
Global Const $sOID_hrDeviceIndex = "1.3.6.1.2.1.25.3.2.1.1"
Global Const $sOID_hrDeviceType = "1.3.6.1.2.1.25.3.2.1.2"
Global Const $sOID_hrDeviceDescr = "1.3.6.1.2.1.25.3.2.1.3"
Global Const $sOID_hrDeviceID = "1.3.6.1.2.1.25.3.2.1.4"
Global Const $sOID_hrDeviceStatus = "1.3.6.1.2.1.25.3.2.1.5"
Global Const $sOID_hrDeviceErrors = "1.3.6.1.2.1.25.3.2.1.6"

Global Const $sOID_hrDevicePrinter = "1.3.6.1.2.1.25.3.1.5"

Global Const $sOID_prtMarkerSuppliesTable =  "1.3.6.1.2.1.43.11.1"
Global Const $sOID_prtMarkerSuppliesEntry =  "1.3.6.1.2.1.43.11.1.1"
Global Const $sOID_prtMarkerSuppliesIndex  =  "1.3.6.1.2.1.43.11.1.1.1"
Global Const $sOID_prtMarkerSuppliesMarkerIndex  =  "1.3.6.1.2.1.43.11.1.1.2"
Global Const $sOID_prtMarkerSuppliesColorantIndex  =  "1.3.6.1.2.1.43.11.1.1.3"
Global Const $sOID_prtMarkerSuppliesClass =  "1.3.6.1.2.1.43.11.1.1.4"
Global Const $sOID_prtMarkerSuppliesType =  "1.3.6.1.2.1.43.11.1.1.5"
Global Const $sOID_prtMarkerSuppliesDescription =  "1.3.6.1.2.1.43.11.1.1.6"
Global Const $sOID_prtMarkerSuppliesSupplyUnit =  "1.3.6.1.2.1.43.11.1.1.7"
Global Const $sOID_prtMarkerSuppliesMaxCapacity =  "1.3.6.1.2.1.43.11.1.1.8"
Global Const $sOID_prtMarkerSuppliesLevel =  "1.3.6.1.2.1.43.11.1.1.9"

Global $aSuppliesTable, $aDevTable, $sSysLoc, $sOID_Root
Global $hProgressGUI, $idProgress, $idLabel, $idScanCancel, $idTV

_Example()

Func _Example()
    $hProgressGUI = GUICreate("Idle.", 300, 350, -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU), $WS_EX_COMPOSITED)
    $idProgress = GUICtrlCreateProgress(10, 10, 280, 40)
    $idScanCancel = GUICtrlCreateButton("Scan", 216, 58, 74, 23)
    $idLabel = GUICtrlCreateLabel("", 10, 60, 100, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE, $WS_BORDER))
    $idTV = GUICtrlCreateTreeView(10, 100, 280, 240)
    GUISetState()

    Local $asIPAddresses = GetRange($sNetAddress, $sNetMask)
    GUICtrlSetLimit($idProgress, UBound($asIPAddresses), 0)
    GUICtrlSendMsg($idProgress, $PBM_SETRANGE, 0, BitOR(BitShift(UBound($asIPAddresses), -16), 0))

    ControlClick($hProgressGUI, "", $idScanCancel)
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $idScanCancel
                GUICtrlSendMsg($idTV, $TVM_DELETEITEM, 0, $TVI_ROOT)
                GUICtrlSetData($idProgress, 0)
                GUICtrlSetData($idScanCancel, "Cancel")
                WinSetTitle($hProgressGUI, "", "Scanning...")
                If _Scan($asIPAddresses) Then ExitLoop

        EndSwitch
    WEnd

    GUIDelete($hProgressGUI)
EndFunc

Func _Scan($asIPAddresses)
    _SNMP_Startup()
    _SNMP_RegMsgHandler("_MsgHandler")
    Local $bExit = False

    For $i = 0 To UBound($asIPAddresses) - 1
        _CheckPrinter($asIPAddresses[$i])
        GUICtrlSetData($idProgress, $i+1)
        GUICtrlSetData($idLabel, $asIPAddresses[$i])

        If $i = UBound($asIPAddresses) - 1 Then
            ControlClick($hProgressGUI, "", $idScanCancel)
        EndIf

        While 1
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    $bExit = True
                    ExitLoop 2

                Case $idScanCancel
                    GUICtrlSetData($idProgress, 0)
                    GUICtrlSetData($idScanCancel, "Scan")
                    WinSetTitle($hProgressGUI, "", "Idle.")
                    ExitLoop 2

                Case 0
                    If $i < UBound($asIPAddresses) - 1 Then ExitLoop

            EndSwitch
        WEnd
    Next

    _SNMP_Shutdown()
    Return $bExit
EndFunc

Func _Wait()
    Local $hTimer = TimerInit()
    Do
        Sleep(50)
    Until TimerDiff($hTimer) > $iTimeout
EndFunc

Func _CheckPrinter($sIPAddress)
    Local $iDevice = _SNMP_OpenDevice($sIPAddress)
    If @error Then Return

    ;Reset the tables.
    $aDevTable = 0
    $aSuppliesTable = 0

    ;$sOID_Root - Only read in SNMP data related to hrDeviceTable.
    $sOID_Root = $sOID_hrDeviceTable
    _SNMP_GetBulk($iDevice, $sOID_hrDeviceTable, $sCommunity, 1, $iBatchSize)
    _Wait() ;Give enough time for data to come back and be processed. Governed by $iTimeout.
    If Not UBound($aDevTable) Then Return _SNMP_CloseDevice($iDevice) ;Can't find device..

    $sOID_Root = $sOID_sysLocation
    _SNMP_GetRequest($iDevice, $sOID_sysLocation & ".0", $sCommunity)
    _Wait()

    $sOID_Root = $sOID_prtMarkerSuppliesTable
    _SNMP_GetBulk($iDevice, $sOID_prtMarkerSuppliesTable, $sCommunity, 1, $iBatchSize)
    _Wait()

    Local $hTVNode = $idTV, $hTVNode2, $fLevel

    For $i = 0 To UBound($aDevTable) - 1
        ;Check if hrDeviceIndex is a printer
        If $aDevTable[$i][1] <> $sOID_hrDevicePrinter Then ContinueLoop
        $hTVNode = GUICtrlCreateTreeViewItem($sIPAddress, $idTV)
        GUICtrlCreateTreeViewItem($aDevTable[$i][2], $hTVNode)
        GUICtrlCreateTreeViewItem($sSysLoc, $hTVNode)
        GUICtrlSetState($hTVNode, $GUI_EXPAND)

        ConsoleWrite("IP:       " & $sIPAddress & @CRLF)
        ConsoleWrite("Device:   " & $aDevTable[$i][2] & @CRLF)
        If $sSysLoc Then ConsoleWrite("Location: " & $sSysLoc & @CRLF)

        For $j = 0 To UBound($aSuppliesTable) - 1
            If $aSuppliesTable[$j][0] <> $aDevTable[$i][0] Then ContinueLoop
            ConsoleWrite(" Consumable: " & $aSuppliesTable[$j][6] & @CRLF)
            $hTVNode2 = GUICtrlCreateTreeViewItem($aSuppliesTable[$j][6], $hTVNode)

            If IsString($aSuppliesTable[$j][9]) Then
                ConsoleWrite("  Level: " & $aSuppliesTable[$j][9] & @CRLF)
                GUICtrlCreateTreeViewItem($aSuppliesTable[$j][9], $hTVNode2)
            Else
                $fLevel = $aSuppliesTable[$j][9] / $aSuppliesTable[$j][8]

                ConsoleWrite(StringFormat("  Level: %d/%d (%d%%)\r\n", _
                        $aSuppliesTable[$j][9], $aSuppliesTable[$j][8], _
                        Int(100 * $fLevel)))
                GUICtrlCreateTreeViewItem(StringFormat("%d/%d (%d%%)", $aSuppliesTable[$j][9], $aSuppliesTable[$j][8], _
                        Int(100 * $fLevel)), $hTVNode2)
                If Not $aSuppliesTable[$j][9] Then GUICtrlSetColor(-1, 0xFF0000)
            EndIf
            GUICtrlSetState($hTVNode2, $GUI_EXPAND)

        Next

        ConsoleWrite(@CRLF)
    Next

    _SNMP_CloseDevice($iDevice)
EndFunc

Func _MsgHandler($iDevice, $dRawPacket, $avHeaders, $avData)
    Local $iBatchNum = $avHeaders[2][1]

    For $i = 0 To UBound($avData) - 1
        ;Stop if we're at the end of the table
        If StringLeft($avData[$i][0], StringLen($sOID_Root)) <> $sOID_Root Then ExitLoop

        Switch $sOID_Root
            Case $sOID_hrDeviceTable
                _DevTableBuilder($avData[$i][0], $avData[$i][2], $i)
            Case $sOID_prtMarkerSuppliesTable
                _ConsumablesTableBuilder($avData[$i][0], $avData[$i][2], $i)
            Case $sOID_sysLocation
                $sSysLoc = $avData[$i][2]
        EndSwitch
;~      ConsoleWrite(StringFormat(" %10s | %50s    %-15s %-20s", $avHeaders[3][1], $avData[$i][0], $avData[$i][1], $avData[$i][2]) & @CRLF)
    Next

    Local $bWalk = ($i = UBound($avData))
    If $avData[UBound($avData) -1][1] = $SNMP_EXC_ENDOFMIB Then $bWalk = False

    ;Not at the end of the table, ask for more data.
    $iBatchNum += 1
    If $bWalk Then _SNMP_GetBulk($iDevice, Default, Default, $iBatchNum, $iBatchSize) ;Get the next batch
EndFunc

Func _DevTableBuilder($sOID, $vData, $iRecord)
    ;Extract the hrDeviceIndex from the OID.
    ;I'm cheating - We're OK for this table, but this method won't work correctly for other tables with > 9 columns.
    ;We should stringsplit with "." and check the correct index.
    Local $sKey = StringTrimLeft($sOID, StringLen($sOID_hrDeviceIndex) + 1)
    Local $mEmptyMap[]
    Local Static $mDevIdx[]
    If Not $iRecord Then
        Local $mEmptyMap[]
        $mDevIdx = $mEmptyMap
    EndIf

    If Not UBound($aDevTable, 0) Then Dim $aDevTable[0][6]

    If Not MapExists($mDevIdx, $sKey) Then
        ;Index for this table is hrDeviceIndex - an integer.
        ;hrDeviceIndex will also will be at $sOID_hrDeviceIndex.hrDeviceIndex
        ; but we technically need a hrDeviceIndex to GetRequest directly!
        ; you could probably cycle through from 1 until there's no response though..
        ; If the system has > 1 device indicies, usually the printer device will be 1.
        $mDevIdx[$sKey] = UBound($aDevTable)
        ReDim $aDevTable[UBound($aDevTable) + 1][6]
    EndIf
    Local $iDevIdx = $mDevIdx[$sKey]

    Switch StringLeft($sOID, StringLen($sOID_hrDeviceIndex))
        Case $sOID_hrDeviceIndex
            $aDevTable[$iDevIdx][0] = $vData

        Case $sOID_hrDeviceType
            $aDevTable[$iDevIdx][1] = $vData

        Case $sOID_hrDeviceDescr
            $aDevTable[$iDevIdx][2] = $vData

        Case $sOID_hrDeviceID
            ;ProductID
            $aDevTable[$iDevIdx][3] = $vData

        Case $sOID_hrDeviceStatus
            $aDevTable[$iDevIdx][4] = $vData
            ;1 = unknown
            ;2 = running
            ;3 = warning
            ;4 = testing
            ;5 = down

        Case $sOID_hrDeviceErrors
            ;Error Counter
            $aDevTable[$iDevIdx][5] = $vData

    EndSwitch
EndFunc

Func _ConsumablesTableBuilder($sOID, $vData, $iRecord)
    ;Again, cheating with StringTrimLeft.
    Local $sKey = StringTrimLeft($sOID, StringLen($sOID_prtMarkerSuppliesIndex) + 1)

    Local Static $mSuppIdx[]
    If Not $iRecord Then
        Local $mEmptyMap[]
        $mSuppIdx = $mEmptyMap
    EndIf

    If Not UBound($aSuppliesTable, 0) Then Dim $aSuppliesTable[0][10]

    If Not MapExists($mSuppIdx, $sKey) Then
        ;Index for this table is hrDeviceIndex.prtMarkerSuppliesIndex
        $mSuppIdx[$sKey] = UBound($aSuppliesTable)
        ReDim $aSuppliesTable[UBound($aSuppliesTable) + 1][10]
        ;Store the hrDeviceIndex, so we can filter consubables per device later.
        ;StringTrimRight - This'll break if there are >9 consumables for the device.
        $aSuppliesTable[$mSuppIdx[$sKey]][0] = StringTrimRight($sKey, 2)
    EndIf
    Local $iSuppIdx = $mSuppIdx[$sKey]

    Switch StringLeft($sOID, StringLen($sOID_prtMarkerSuppliesIndex))
        Case $sOID_prtMarkerSuppliesIndex
            $aSuppliesTable[$iSuppIdx][1] = $vData

        Case $sOID_prtMarkerSuppliesMarkerIndex
            $aSuppliesTable[$iSuppIdx][2] = $vData

        Case $sOID_prtMarkerSuppliesColorantIndex
            $aSuppliesTable[$iSuppIdx][3] = $vData

        Case $sOID_prtMarkerSuppliesClass
            $aSuppliesTable[$iSuppIdx][4] = $vData

        Case $sOID_prtMarkerSuppliesType
            $aSuppliesTable[$iSuppIdx][5] = $vData
            ; other = 1
            ; unknown = 2
            ; toner = 3
            ; wasteToner = 4
            ; ink = 5
            ; inkCartridge = 6
            ; inkRibbon = 7
            ; wasteInk = 8
            ; opc = 9
            ; developer = 10
            ; fuserOil = 11
            ; solidWax = 12
            ; ribbonWax = 13
            ; wasteWax = 14

        Case $sOID_prtMarkerSuppliesDescription
            $aSuppliesTable[$iSuppIdx][6] = $vData

        Case $sOID_prtMarkerSuppliesSupplyUnit
            $aSuppliesTable[$iSuppIdx][7] = $vData

        Case $sOID_prtMarkerSuppliesMaxCapacity
            Switch $vData
                Case -1
                    $aSuppliesTable[$iSuppIdx][8]  = "Unlimited"
                Case -2
                    $aSuppliesTable[$iSuppIdx][8]  = "Unknown"
                Case Else
                    $aSuppliesTable[$iSuppIdx][8] = $vData
            EndSwitch

        Case $sOID_prtMarkerSuppliesLevel
            Switch $vData
                Case -1
                    $aSuppliesTable[$iSuppIdx][9]  = "Unlimited"
                Case -2
                    $aSuppliesTable[$iSuppIdx][9]  = "Unknown"
                Case -3
                    $aSuppliesTable[$iSuppIdx][9]  = "Unknown (but not exhausted)"
                Case Else
                    $aSuppliesTable[$iSuppIdx][9] = $vData
            EndSwitch
    EndSwitch
EndFunc

Func GetRange($sIP, $sNetMask)
    ;Generate array of IP addresses.
    Local $aIPRange[2][4], $iIP, $iMask
    $aIP = StringSplit($sIP, ".", 2)
    $aMask = StringSplit($sNetMask, ".", 2)

    For $i = 0 To 3
        $iIP = BitShift($iIP, -8)
        $iMask = BitShift($iMask, -8)
        $iIP += Int($aIP[$i])
        $iMask += Int($aMask[$i])
    Next

    Local $iNet =  BitAND($iIP, $iMask)
    Local $iFirst = $iNet + 1
    Local $iBCast = BitOr($iNet, BitNot($iMask))
    Local $iLast = $iBCast - 1

    Local $asIPAddresses[($iLast - $iFirst) + 1]

    Local $sIP2, $iIP
    For $i = $iFirst To $iLast
        $iIP = $i
        $sIP2 = ""
        For $j = 1 To 4
            $sIP2 = BitAND($iIP, 0xFF) & "." & $sIP2
            $iIP = BitShift($iIP, 8)
        Next
        $asIPAddresses[$i - $iFirst] = StringTrimRight($sIP2, 1)
    Next

    Return $asIPAddresses
EndFunc
Posted

@water could you be so nice and take a look here.
Maybe this UDF should be added to:
https://www.autoitscript.com/wiki/User_Defined_Functions

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

I've added this UDF to the wiki :) 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
×
×
  • Create New...