Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/12/2015 in all areas

  1. Nope, everything is right there. Free your mind out of AutoIt and reread again. VB uses this syntax to declare array: Dim Arr(100)...but that's shorter for: Dim Arr(0 To 100)Which means "Create array which first index is 0 and last is 100". How many elements are there?
    1 point
  2. czardas

    UBound Return Discussion

    Yep exactly that! Ubound means upper boundary - and not the final index number. This is not a misnomer.
    1 point
  3. If I may, I can see 2 uses for such a function: Getting the number of elements in an array so that other variables might be sized accordingly.Getting the top index of the array - which is what the VBasic version of the function does.As AutoIt uses 0-based arrays these 2 values are not the same, with the first always being one more than the second. So there was a choice to be made (by Valik I believe) when the function was added to AutoIt: ; What we do now Local $aNewArray[UBound($aOldArray)] For $i = 0 To UBound($aOldArray) - 1or ; What might have happened Local $aNewArray[UBound($aOldArray) + 1] For $i = 0 To UBound($aOldArray)I see pros and cons in both approaches - but I am now so used to the way we have to do it. Personally I feel the function is wrongly named, but as the return value is quite specifically described in the Help file I see no problem with what it actually means. M23
    1 point
  4. You could use WMI to get a list of processes. The example script "Scriptomatic" creates AutoIt code for you. The following stripped down example returns a list of processes running on the other computer. Replace "." with the name of this computer. ; Generated by AutoIt Scriptomatic #include <Array.au3> Global $wbemFlagReturnImmediately = 0x10 Global $wbemFlagForwardOnly = 0x20 Global $colItems = "" Global $strComputer = "." Global $i = 0 Global $aResult[10000] $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $aResult[$i] = $objItem.Caption $i = $i + 1 Next ReDim $aresult[$i] _ArrayDisplay($aResult) Else MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_Process") EndIf
    1 point
  5. Depending on the further use, Inet could be used - much faster #Include <Array.au3> $source = BinaryToString(InetRead("https://www.reddit.com/r/texans", 1)) $res = StringRegExp($source,'user/(.*?)"', 3) _ArrayDisplay($res)
    1 point
  6. Did you have a look at my Active Direcotry UDF (for download please see my signature)? It has a function to join a PC to a domain plus it returns meaningful error information.
    1 point
  7. close, no need for class #include <IE.au3> #include <array.au3> $Texans = _IECreate("http://www.reddit.com/r/texans", 0, 0, 1) $TexansHTML = _IEDocReadHTML($Texans) _IEQuit($Texans) $TexansUsernames = StringRegExp($TexansHTML,'user\/(.*?)\"', 3) _ArrayDisplay($TexansUsernames)
    1 point
  8. TheDcoder

    AutoIt Snippets

    Finally another snippet! I use this little function to check if a number is present in a number (Magic numbers)... Magic numbers are powers of 2 (like 16, 32, 64 etc.) which can be added BitORed together to form a magic number... ; #FUNCTION# ==================================================================================================================== ; Name ..........: IsMgcNumPresent ; Description ...: Checks if a number is a present in a number (Magic numbers aka Powers of 2) ; Syntax ........: IsMgcNumPresent($iNumber, $iMagicNumber) ; Parameters ....: $iNumber - Number to check if it exists in $iMagicNumber. ; $iMagicNumber - The number which might contain $iNumber. ; Return values .: Success: True ; Failure: False ; Author ........: Damon Harris (TheDcoder) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://bit.ly/IsMgcNumPresentForAutoIt ; Example .......: Yes, see below. ; =============================================================================================================================== Func IsMgcNumPresent($iNumber, $iMagicNumber) Return BitAND($iMagicNumber, $iNumber) = $iNumber EndFunc ; Example Global Const $NUMBER = 32 Global Const $MAGIC_NUMBER = BitOR(32, 64) ConsoleWrite(@CRLF) ConsoleWrite('+> Is ' & $NUMBER & ' present in ' & $MAGIC_NUMBER & '?... Its ' & IsMgcNumPresent($NUMBER, $MAGIC_NUMBER) & @CRLF) ConsoleWrite(@CRLF) UPDATE: I have moved this snippet to Gist, I will no longer maintain this version! please check for updates in the Gist itself! Enjoy, TD
    1 point
×
×
  • Create New...