<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.autoitscript.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=DatMCEyeBall</id>
	<title>AutoIt Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.autoitscript.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=DatMCEyeBall"/>
	<link rel="alternate" type="text/html" href="https://www.autoitscript.com/wiki/Special:Contributions/DatMCEyeBall"/>
	<updated>2026-04-21T16:09:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Array_)&amp;diff=11934</id>
		<title>Snippets ( AutoIt Array )</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Array_)&amp;diff=11934"/>
		<updated>2013-10-22T19:01:20Z</updated>

		<summary type="html">&lt;p&gt;DatMCEyeBall: /* _ArrayEmpty */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
[[category:Snippets]]&lt;br /&gt;
&lt;br /&gt;
{{Snippet Credit Header}}&lt;br /&gt;
&lt;br /&gt;
== _1Dto2DArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $aArray_1D[2] = [&amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;]&lt;br /&gt;
_ArrayDisplay($aArray_1D)&lt;br /&gt;
_1Dto2DArray($aArray_1D)&lt;br /&gt;
_ArrayDisplay($aArray_1D)&lt;br /&gt;
&lt;br /&gt;
Global $aArray_1D[10] = [&amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;]&lt;br /&gt;
_ArrayDisplay($aArray_1D)&lt;br /&gt;
_1Dto2DArray($aArray_1D, 9)&lt;br /&gt;
_ArrayDisplay($aArray_1D)&lt;br /&gt;
&lt;br /&gt;
Func _1Dto2DArray(ByRef $aArray, Const $iAdditionalColumns = 1)&lt;br /&gt;
    Local Const $iSize = UBound($aArray, 1)&lt;br /&gt;
&lt;br /&gt;
    Local $aReturn[$iSize][$iAdditionalColumns + 1]&lt;br /&gt;
&lt;br /&gt;
    For $A = 0 To $iSize - 1&lt;br /&gt;
        $aReturn[$A][0] = $aArray[$A]&lt;br /&gt;
    Next&lt;br /&gt;
&lt;br /&gt;
    $aArray = $aReturn&lt;br /&gt;
&lt;br /&gt;
    Return $aReturn&lt;br /&gt;
EndFunc   ;==&amp;gt;_1Dto2DArray&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArrayAddEx ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example_1()&lt;br /&gt;
Example_2()&lt;br /&gt;
&lt;br /&gt;
Func Example_1()&lt;br /&gt;
    Local $aArray_1[1] = [&amp;quot;Data_0&amp;quot;], $iBegin&lt;br /&gt;
&lt;br /&gt;
    $iBegin = TimerInit() ; Start the timer.&lt;br /&gt;
    For $i = 1 To 5000&lt;br /&gt;
        _ArrayAdd($aArray_1, &amp;quot;Data_&amp;quot; &amp;amp; $i)&lt;br /&gt;
    Next&lt;br /&gt;
    $iBegin = TimerDiff($iBegin) ; End the timer and find the difference from start to finish.&lt;br /&gt;
    ConsoleWrite(&amp;quot;_ArrayAdd from Array.au3 &amp;gt;&amp;gt; &amp;quot; &amp;amp; $iBegin &amp;amp; @CRLF)&lt;br /&gt;
    _ArrayDisplay($aArray_1)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example_1&lt;br /&gt;
&lt;br /&gt;
Func Example_2()&lt;br /&gt;
    Local $aArray_2[1] = [&amp;quot;Data_0&amp;quot;], $iBegin, $iDimension, $iCount&lt;br /&gt;
&lt;br /&gt;
    $iBegin = TimerInit() ; Start the timer.&lt;br /&gt;
    For $i = 1 To 5000&lt;br /&gt;
        _ArrayAddEx($aArray_2, &amp;quot;Data_&amp;quot; &amp;amp; $i, $iDimension, $iCount) ; $iDimension is the overall size of the array &amp;amp; $iCount is the last index number, because regarding the overall size +1 as the next item will give false results as we&#039;re increasing the size of the array not by 1 but multiplying 2.&lt;br /&gt;
    Next&lt;br /&gt;
    $iBegin = TimerDiff($iBegin) ; End the timer and find the difference from start to finish.&lt;br /&gt;
    ConsoleWrite(&amp;quot;_ArrayAddEx by guinness &amp;gt;&amp;gt; &amp;quot; &amp;amp; $iBegin &amp;amp; @CRLF)&lt;br /&gt;
    ReDim $aArray_2[$iCount] ; Remove the empty rows.&lt;br /&gt;
    _ArrayDisplay($aArray_2)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example_2&lt;br /&gt;
&lt;br /&gt;
Func _ArrayAddEx(ByRef $aArray, $sData, ByRef $iDimension, ByRef $iCount) ; Taken from Array.au3 and modified by guinness to reduce the use of ReDim.&lt;br /&gt;
    If IsArray($aArray) = 0 Then&lt;br /&gt;
        Return SetError(1, 0, -1)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    If UBound($aArray, 0) &amp;lt;&amp;gt; 1 Then&lt;br /&gt;
        Return SetError(2, 0, -1)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    If $iCount = 0 Then&lt;br /&gt;
        $iCount = UBound($aArray, 1)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    $iCount += 1&lt;br /&gt;
    If ($iCount + 1) &amp;gt;= $iDimension Then&lt;br /&gt;
        $iDimension = (UBound($aArray, 1) + 1) * 2&lt;br /&gt;
        ReDim $aArray[$iDimension]&lt;br /&gt;
    EndIf&lt;br /&gt;
    $aArray[$iCount - 1] = $sData&lt;br /&gt;
    Return $iCount - 1&lt;br /&gt;
EndFunc   ;==&amp;gt;_ArrayAddEx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArrayEmpty ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
|Desc=Creates Empty 1D &amp;amp; 2D Array&#039;s&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $aMain[11] = [10]&lt;br /&gt;
_ArrayEmpty($aMain)&lt;br /&gt;
_ArrayDisplay($aMain, &amp;quot;Empty 1D Array.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Global $aMainEx[11][3] = [[10]]&lt;br /&gt;
_ArrayEmpty($aMainEx)&lt;br /&gt;
_ArrayDisplay($aMainEx, &amp;quot;Empty 2D Array.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Func _ArrayEmpty(ByRef $aArray)&lt;br /&gt;
    Switch UBound($aArray, 0) ; Dimension, 1D or 2D array are supported.&lt;br /&gt;
        Case 1&lt;br /&gt;
            Local $aEmpty1D[1]&lt;br /&gt;
            $aArray = $aEmpty1D&lt;br /&gt;
&lt;br /&gt;
        Case 2&lt;br /&gt;
            ; Edit by DatMCEyeBall - Instead of emptying the array to [1][$x] we empty it to [$x][$y]&lt;br /&gt;
            ; where $x is the 1st dimensions size and $y the 2nd.&lt;br /&gt;
            ; Previous code was: Local $aEmpty2D[1][UBound($aArray, 2)]&lt;br /&gt;
            ; This way we preserve the arrays&#039; original size.&lt;br /&gt;
            Local $aEmpty2D[UBound($aArray, 1)][UBound($aArray, 2)]&lt;br /&gt;
            $aArray = $aEmpty2D&lt;br /&gt;
    EndSwitch&lt;br /&gt;
EndFunc   ;==&amp;gt;_ArrayEmpty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArrayGet ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=31965-progandy&lt;br /&gt;
|AuthorName=ProgAndy&lt;br /&gt;
|Desc=Easy access for nested arrays up to 20 nested dimensions (including multidimensional arrays)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Global $b[2] = [&amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;]&lt;br /&gt;
Global $a[3][2] = [[0, -1], [$b, &amp;quot;x&amp;quot;], [1, -2]]&lt;br /&gt;
&lt;br /&gt;
Global $c[5] = [11, 22, 33, 44, 55]&lt;br /&gt;
&lt;br /&gt;
MsgBox(0, &amp;quot;&amp;quot;, _ArrayGet($a, 1, 0, 1) &amp;amp; &amp;quot; # &amp;quot; &amp;amp; @error)&lt;br /&gt;
&lt;br /&gt;
; #FUNCTION# ====================================================================================================================&lt;br /&gt;
; Name ..........: _ArrayGet&lt;br /&gt;
; Description ...: Gets a value from a nested multidimensional array&lt;br /&gt;
; Syntax ........: _ArrayGet(Byref $aArray, $i1[, $i2 = 0[, $i3 = 0[, $i4 = 0[, $i5 = 0[, $i6 = 0[, $i7 = 0[, $i8 = 0[,&lt;br /&gt;
;                 $i9 = 0[, $i10 = 0[, $i11 = 0[, $i12 = 0[, $i13 = 0[, $i14 = 0[, $i15 = 0[, $i16 = 0[, $i17 = 0[,&lt;br /&gt;
;                 $i18 = 0[, $i19 = 0[, $i20 = 0]]]]]]]]]]]]]]]]]]])&lt;br /&gt;
; Parameters ....: $aArray            - [in/out] An array of unknowns.&lt;br /&gt;
;                 $i1                 - first array index.&lt;br /&gt;
;                 $i2                 - [optional] second array index.&lt;br /&gt;
;                 $i3                 - [optional] third array index.&lt;br /&gt;
;                 $i4                 - [optional] fourth array index.&lt;br /&gt;
;                 $i5                 - [optional] fifth array index.&lt;br /&gt;
;                 $i6                 - [optional] sixth array index.&lt;br /&gt;
;                 $i7                 - [optional] seventh array index.&lt;br /&gt;
;                 $i8                 - [optional] eighth array index.&lt;br /&gt;
;                 $i9                 - [optional] ninth array index.&lt;br /&gt;
;                 $i10               - [optional] 10th array index.&lt;br /&gt;
;                 $i11               - [optional] 11th array index.&lt;br /&gt;
;                 $i12               - [optional] 12th array index.&lt;br /&gt;
;                 $i13               - [optional] 13th array index.&lt;br /&gt;
;                 $i14               - [optional] 14th array index.&lt;br /&gt;
;                 $i15               - [optional] 15th array index.&lt;br /&gt;
;                 $i16               - [optional] 16th array index.&lt;br /&gt;
;                 $i17               - [optional] 17th array index.&lt;br /&gt;
;                 $i18               - [optional] 18th array index.&lt;br /&gt;
;                 $i19               - [optional] 19th array index.&lt;br /&gt;
;                 $i20               - [optional] 20th array index.&lt;br /&gt;
; Return values .: Success: Value at the specified index&lt;br /&gt;
;                 Error: Nothing, Sets @error to:&lt;br /&gt;
;                 |1 - Trying to acces non-array as array&lt;br /&gt;
;                 |2 - Not enough dimensions for the last accessed array&lt;br /&gt;
;                 |3 - Index out of bounds for a dimension&lt;br /&gt;
;                 @extended contains the dimension in error (according to parameter list)&lt;br /&gt;
; Author ........: ProgAndy&lt;br /&gt;
; Modified ......:&lt;br /&gt;
; Remarks .......:&lt;br /&gt;
; Related .......:&lt;br /&gt;
; Link ..........:&lt;br /&gt;
; Example .......: No&lt;br /&gt;
; ===============================================================================================================================&lt;br /&gt;
Func _ArrayGet(ByRef $aArray, $i1, $i2=0, $i3=0, $i4=0, $i5=0, $i6=0, $i7=0, $i8=0, $i9=0, $i10=0, $i11=0, $i12=0, $i13=0, $i14=0, $i15=0, $i16=0, $i17=0, $i18=0, $i19=0, $i20=0)&lt;br /&gt;
	#forceref $i1, $i2, $i3, $i4, $i5, $i6, $i7, $i8, $i9, $i10, $i11, $i12, $i13, $i14, $i15, $i16, $i17, $i18, $i19, $i20&lt;br /&gt;
   ; ProgAndy&lt;br /&gt;
    Local $NULL&lt;br /&gt;
    If Not IsArray($aArray) Then Return SetError(1, 1, $NULL)&lt;br /&gt;
    Local $iDims = UBound($aArray, 0)&lt;br /&gt;
    If @NumParams &amp;lt;= $iDims Then Return SetError(2, @NumParams, $NULL)&lt;br /&gt;
    Local $sAccess = &amp;quot;$aArray&amp;quot;&lt;br /&gt;
    For $i = 1 To $iDims&lt;br /&gt;
        Local $iIndex = Int(Eval(&amp;quot;i&amp;quot; &amp;amp; $i))&lt;br /&gt;
        If $iIndex &amp;gt;= UBound($aArray, $i) Then Return SetError(3, $i, $NULL)&lt;br /&gt;
        $sAccess &amp;amp;= &#039;[&#039; &amp;amp; $iIndex &amp;amp; &#039;]&#039;&lt;br /&gt;
    Next&lt;br /&gt;
    If @NumParams-1 &amp;gt; $iDims Then ; Still indices left&lt;br /&gt;
        For $i = $iDims+1 To @NumParams-1&lt;br /&gt;
            $sAccess &amp;amp;= &amp;quot;, $i&amp;quot; &amp;amp; $i&lt;br /&gt;
        Next&lt;br /&gt;
        Local $vResult = Execute(&amp;quot;_ArrayGet(&amp;quot; &amp;amp; $sAccess &amp;amp; &amp;quot;)&amp;quot;)&lt;br /&gt;
        If @error Then SetError(@error, @extended+$iDims)&lt;br /&gt;
        Return $vResult&lt;br /&gt;
    Else ;&lt;br /&gt;
        Return Execute($sAccess)&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArraySet ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=31965-progandy&lt;br /&gt;
|AuthorName=ProgAndy&lt;br /&gt;
|Desc=Easy access for nested arrays up to 20 nested dimensions (including multidimensional arrays)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Global $b[2] = [&#039;a&#039;, &#039;b&#039;&lt;br /&gt;
Global $a[3][2] = [[0, -1], [$b, &amp;quot;x&amp;quot;], [1, -2]]&lt;br /&gt;
&lt;br /&gt;
Global $c[5] = [11, 22, 33, 44, 55]&lt;br /&gt;
&lt;br /&gt;
_ArraySet($a, $c, 1, 0, 0)&lt;br /&gt;
&lt;br /&gt;
; #FUNCTION# ====================================================================================================================&lt;br /&gt;
; Name ..........: _ArraySet&lt;br /&gt;
; Description ...: Sets a value from a nested multidimensional array&lt;br /&gt;
; Syntax ........: _ArraySet(Byref $aArray, $vValue, $i1[, $i2 = 0[, $i3 = 0[, $i4 = 0[, $i5 = 0[, $i6 = 0[, $i7 = 0[, $i8 = 0[,&lt;br /&gt;
;                 $i9 = 0[, $i10 = 0[, $i11 = 0[, $i12 = 0[, $i13 = 0[, $i14 = 0[, $i15 = 0[, $i16 = 0[, $i17 = 0[,&lt;br /&gt;
;                 $i18 = 0[, $i19 = 0[, $i20 = 0]]]]]]]]]]]]]]]]]]])&lt;br /&gt;
; Parameters ....: $aArray            - [in/out] An array of unknowns.&lt;br /&gt;
;                 $vValue             - value to set at specified index.&lt;br /&gt;
;                 $i1                 - first array index.&lt;br /&gt;
;                 $i2                 - [optional] second array index.&lt;br /&gt;
;                 $i3                 - [optional] third array index.&lt;br /&gt;
;                 $i4                 - [optional] fourth array index.&lt;br /&gt;
;                 $i5                 - [optional] fifth array index.&lt;br /&gt;
;                 $i6                 - [optional] sixth array index.&lt;br /&gt;
;                 $i7                 - [optional] seventh array index.&lt;br /&gt;
;                 $i8                 - [optional] eighth array index.&lt;br /&gt;
;                 $i9                 - [optional] ninth array index.&lt;br /&gt;
;                 $i10               - [optional] 10th array index.&lt;br /&gt;
;                 $i11               - [optional] 11th array index.&lt;br /&gt;
;                 $i12               - [optional] 12th array index.&lt;br /&gt;
;                 $i13               - [optional] 13th array index.&lt;br /&gt;
;                 $i14               - [optional] 14th array index.&lt;br /&gt;
;                 $i15               - [optional] 15th array index.&lt;br /&gt;
;                 $i16               - [optional] 16th array index.&lt;br /&gt;
;                 $i17               - [optional] 17th array index.&lt;br /&gt;
;                 $i18               - [optional] 18th array index.&lt;br /&gt;
;                 $i19               - [optional] 19th array index.&lt;br /&gt;
;                 $i20               - [optional] 20th array index.&lt;br /&gt;
; Return values .: Success: True&lt;br /&gt;
;                 Error: False, Sets @error to:&lt;br /&gt;
;                 |1 - Trying to acces non-array as array&lt;br /&gt;
;                 |2 - Not enough dimensions for the last accessed array&lt;br /&gt;
;                 |3 - Index out of bounds for a dimension&lt;br /&gt;
;                 |all: - @extended contains the dimension in error (according to parameter list)&lt;br /&gt;
; Author ........: ProgAndy&lt;br /&gt;
; Modified ......:&lt;br /&gt;
; Remarks .......:&lt;br /&gt;
; Related .......:&lt;br /&gt;
; Link ..........:&lt;br /&gt;
; Example .......: No&lt;br /&gt;
; ===============================================================================================================================&lt;br /&gt;
Func _ArraySet(ByRef $aArray, Const $vValue, $i1, $i2=0, $i3=0, $i4=0, $i5=0, $i6=0, $i7=0, $i8=0, $i9=0, $i10=0, $i11=0, $i12=0, $i13=0, $i14=0, $i15=0, $i16=0, $i17=0, $i18=0, $i19=0, $i20=0)&lt;br /&gt;
    ; ProgAndy&lt;br /&gt;
    Local Const $NULL = False&lt;br /&gt;
&lt;br /&gt;
    If Not IsArray($aArray) Then Return SetError(1, 1, $NULL)&lt;br /&gt;
&lt;br /&gt;
    Local $iDims = UBound($aArray, 0)&lt;br /&gt;
&lt;br /&gt;
    If @NumParams-2 &amp;lt; $iDims Then Return SetError(2, @NumParams-1, $NULL)&lt;br /&gt;
&lt;br /&gt;
    Local $sAccess = &amp;quot;$aArray&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    For $i = 1 To $iDims&lt;br /&gt;
        Local $iIndex = Int(Eval(&amp;quot;i&amp;quot; &amp;amp; $i))&lt;br /&gt;
        If $iIndex &amp;gt;= UBound($aArray, $i) Then Return SetError(3, $i, $NULL)&lt;br /&gt;
        $sAccess &amp;amp;= &#039;[&#039; &amp;amp; $iIndex &amp;amp; &#039;]&#039;&lt;br /&gt;
    Next&lt;br /&gt;
&lt;br /&gt;
    If @NumParams-2 &amp;gt; $iDims Then&lt;br /&gt;
        $sAccess &amp;amp;= &amp;quot;, $vValue&amp;quot;&lt;br /&gt;
        For $i = $iDims+1 To @NumParams-2&lt;br /&gt;
            $sAccess &amp;amp;= &amp;quot;, $i&amp;quot; &amp;amp; $i&lt;br /&gt;
        Next&lt;br /&gt;
        Local $fSuccess = Execute(&amp;quot;_ArraySet(&amp;quot; &amp;amp; $sAccess &amp;amp; &amp;quot;)&amp;quot;)&lt;br /&gt;
        If @error Then SetError(@error, @extended+$iDims)&lt;br /&gt;
        Return $fSuccess&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    Switch $iDims&lt;br /&gt;
        Case 1&lt;br /&gt;
            $aArray[$i1] = $vValue&lt;br /&gt;
        Case 2&lt;br /&gt;
            $aArray[$i1][$i2] = $vValue&lt;br /&gt;
        Case 3&lt;br /&gt;
            $aArray[$i1][$i2][$i3] = $vValue&lt;br /&gt;
        Case 4&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4] = $vValue&lt;br /&gt;
        Case 5&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5] = $vValue&lt;br /&gt;
        Case 6&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6] = $vValue&lt;br /&gt;
        Case 7&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7] = $vValue&lt;br /&gt;
        Case 8&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8] = $vValue&lt;br /&gt;
        Case 9&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9] = $vValue&lt;br /&gt;
        Case 10&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10] = $vValue&lt;br /&gt;
        Case 11&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11] = $vValue&lt;br /&gt;
        Case 12&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12] = $vValue&lt;br /&gt;
        Case 13&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13] = $vValue&lt;br /&gt;
        Case 14&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14] = $vValue&lt;br /&gt;
        Case 15&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15] = $vValue&lt;br /&gt;
        Case 16&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16] = $vValue&lt;br /&gt;
        Case 17&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16][$i17] = $vValue&lt;br /&gt;
        Case 18&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16][$i17][$i18] = $vValue&lt;br /&gt;
        Case 19&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16][$i17][$i18][$i19] = $vValue&lt;br /&gt;
        Case 20&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16][$i17][$i18][$i19][$i20] = $vValue&lt;br /&gt;
	EndSwitch&lt;br /&gt;
&lt;br /&gt;
    Return True&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArrayLength ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Global $aArray[2][50]&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 2) &amp;amp; @CRLF) ;= &amp;gt; 10 - Total items&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 1) &amp;amp; @CRLF) ;= &amp;gt; 5 - Columns&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 0) &amp;amp; @CRLF) ;= &amp;gt; 2 - Rows&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(@CRLF)&lt;br /&gt;
&lt;br /&gt;
Global $aArray[2]&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 2) &amp;amp; @CRLF) ;= &amp;gt; 2 - Total items&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 1) &amp;amp; @CRLF) ;= &amp;gt; 1 - Columns&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 0) &amp;amp; @CRLF) ;= &amp;gt; 2 - Rows&lt;br /&gt;
&lt;br /&gt;
Func _ArrayLength($aArray, $iType = 1)&lt;br /&gt;
    Local $iDim = UBound($aArray, 0)&lt;br /&gt;
&lt;br /&gt;
    If $iDim &amp;lt; 0 Or $iDim &amp;gt; 2 Then ; If not a 1D or 2D Array, then return -1 and set @error to non-zero.&lt;br /&gt;
        Return SetError(1, 0, -1)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    Switch $iType&lt;br /&gt;
        Case 2&lt;br /&gt;
            If $iDim = 2 Then&lt;br /&gt;
                Return UBound($aArray, 2) * UBound($aArray, 1)&lt;br /&gt;
            Else&lt;br /&gt;
                Return UBound($aArray, 1)&lt;br /&gt;
            EndIf&lt;br /&gt;
&lt;br /&gt;
        Case 1&lt;br /&gt;
            If $iDim = 2 Then&lt;br /&gt;
                Return UBound($aArray, 2)&lt;br /&gt;
            Else&lt;br /&gt;
                Return 1&lt;br /&gt;
            EndIf&lt;br /&gt;
&lt;br /&gt;
        Case Else&lt;br /&gt;
            Return UBound($aArray, 1)&lt;br /&gt;
    EndSwitch&lt;br /&gt;
EndFunc   ;==&amp;gt;_ArrayLength&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArraySortNum ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=4813-smoke-n&lt;br /&gt;
|AuthorName=SmOke_N&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; ArraySortNum(ByRef $nArray, $Ascending = 0, $Start = 1)&lt;br /&gt;
; Sorts arrays based on TRUE Numerical Order, including Decimals&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Example sort Array created with StringSplit.&lt;br /&gt;
Global $avArray = StringSplit(&amp;quot;6,8,10,4,2,13,12,129,106.1,106.4&amp;quot;, &amp;quot;,&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
_ArraySortNum($avArray, 1)&lt;br /&gt;
_ArrayDisplay($avArray, &amp;quot;Sorted Desc starting at 1&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Func _ArraySortNum(ByRef $nArray, $Ascending = 0, $Start = 1)&lt;br /&gt;
	For $i = $Start To UBound($nArray) - 2&lt;br /&gt;
		Local $SE = $i&lt;br /&gt;
&lt;br /&gt;
		If $Ascending = 0 Then&lt;br /&gt;
			For $x = $i To UBound($nArray) - 1&lt;br /&gt;
				If Number($nArray[$SE]) &amp;lt; Number($nArray[$x]) Then $SE = $x&lt;br /&gt;
			Next&lt;br /&gt;
		Else&lt;br /&gt;
			For $x = $i To UBound($nArray) - 1&lt;br /&gt;
				If Number($nArray[$SE]) &amp;gt; Number($nArray[$x]) Then $SE = $x&lt;br /&gt;
			Next&lt;br /&gt;
		EndIf&lt;br /&gt;
&lt;br /&gt;
		Local $HLD = $nArray[$i]&lt;br /&gt;
&lt;br /&gt;
		$nArray[$i] = $nArray[$SE]&lt;br /&gt;
&lt;br /&gt;
		$nArray[$SE] = $HLD&lt;br /&gt;
	Next&lt;br /&gt;
EndFunc   ;==&amp;gt;_ArraySortNum&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _AssocArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=31149-milesahead&lt;br /&gt;
|AuthorName=MilesAhead&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; use Scripting.Dictionary object for simple associative arrays&lt;br /&gt;
; with string keys. Key comparisons are case insensitive.&lt;br /&gt;
&lt;br /&gt;
Global $myArray&lt;br /&gt;
$myArray = _AssocArray()&lt;br /&gt;
If @error Then&lt;br /&gt;
    MsgBox(0x1010,&amp;quot;_AssocArray() Error&amp;quot;, &amp;quot;Error Creating Associative Array!&amp;quot;)&lt;br /&gt;
    Exit&lt;br /&gt;
EndIf&lt;br /&gt;
&lt;br /&gt;
$myArray(&amp;quot;AntiqueWhite&amp;quot;) = 0xFAEBD7&lt;br /&gt;
$myArray(&amp;quot;Black&amp;quot;) = 0x000000&lt;br /&gt;
$myArray(&amp;quot;Blue&amp;quot;) = 0x0000FF&lt;br /&gt;
$myArray(&amp;quot;Brown&amp;quot;) = 0xA52A2A&lt;br /&gt;
$myArray(&amp;quot;CadetBlue&amp;quot;) = 0x5F9EA0&lt;br /&gt;
$myArray(&amp;quot;Chocolate&amp;quot;) = 0xD2691E&lt;br /&gt;
$myArray(&amp;quot;Coral&amp;quot;) = 0xFF7F50&lt;br /&gt;
&lt;br /&gt;
MsgBox(0x1040,&amp;quot;&amp;quot;,&amp;quot;Hex for Chocolate Color is: 0x&amp;quot; &amp;amp; Hex($myArray(&amp;quot;Chocolate&amp;quot;),6))&lt;br /&gt;
_AssocArrayDestroy($myArray)&lt;br /&gt;
&lt;br /&gt;
Func _AssocArray()&lt;br /&gt;
    Local $aArray = ObjCreate(&amp;quot;Scripting.Dictionary&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(1, 0, 0)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    $aArray.CompareMode = 1&lt;br /&gt;
&lt;br /&gt;
    Return $aArray&lt;br /&gt;
EndFunc   ;==&amp;gt;_AssocArray&lt;br /&gt;
&lt;br /&gt;
Func _AssocArrayDestroy(ByRef $aArray)&lt;br /&gt;
    If Not IsObj($aArray) Then&lt;br /&gt;
        Return False&lt;br /&gt;
    EndIf&lt;br /&gt;
    $aArray.RemoveAll()&lt;br /&gt;
    $aArray = 0&lt;br /&gt;
    Return True&lt;br /&gt;
EndFunc   ;==&amp;gt;_AssocArrayDestroy&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _FuncListToArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=52-geosoft&lt;br /&gt;
|AuthorName=GEOSoft&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
$aFlist = _FuncListToArray(@ScriptFullPath)&lt;br /&gt;
If NOT @Error Then&lt;br /&gt;
   For $i = 0 To Ubound($aFlist) -1&lt;br /&gt;
      MsgBox(0, &amp;quot;TEST&amp;quot;, $aFlist[$i], 2)&lt;br /&gt;
   Next&lt;br /&gt;
EndIf&lt;br /&gt;
&lt;br /&gt;
Func _FuncListToArray($sStr)&lt;br /&gt;
   If FileExists($sStr) Then $sStr = FileRead($sStr)&lt;br /&gt;
   Local $sRegEx = &amp;quot;(?i)(?m:^|\n)\s*Func\s+(\w+)\s*\(&amp;quot;&lt;br /&gt;
   $aRegEx = StringRegExp($sStr, $sRegEx, 3)&lt;br /&gt;
   If IsArray($aRegEx) Then Return $aRegEx&lt;br /&gt;
   Return SetError(1)&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Identify Duplicate Values In Arrays ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=1967-garyfrost&lt;br /&gt;
|AuthorName=GaryFrost&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Identify Duplicate Values In Arrays&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $a1[3] = [1, 2, 3], $a2[5] = [5, 6, 7, 8, 9], $a3[2] = [3, 5]&lt;br /&gt;
Global $a_a[4] = [3, $a1, $a2, $a3]&lt;br /&gt;
MsgBox(0, &amp;quot;Dupes?&amp;quot;, _SearchForDupes($a_a))&lt;br /&gt;
&lt;br /&gt;
Func _SearchForDupes($a_arrays, $i_ReturnType = 0)&lt;br /&gt;
	Local $Dupes[1] = [0]&lt;br /&gt;
&lt;br /&gt;
	If $a_arrays[0] &amp;lt; 2 Then Return &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
	For $i = 1 To $a_a[0] - 1&lt;br /&gt;
		For $j = $i + 1 To $a_a[0]&lt;br /&gt;
			_FindDupe($a_a[$i], $a_a[$j], $Dupes)&lt;br /&gt;
		Next&lt;br /&gt;
	Next&lt;br /&gt;
&lt;br /&gt;
	If $Dupes[0] = 0 Then Return &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
	_ArraySort($Dupes)&lt;br /&gt;
&lt;br /&gt;
	If Not $i_ReturnType Then&lt;br /&gt;
		Local $s_return = &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
		For $x = 1 To $Dupes[0]&lt;br /&gt;
			$s_return &amp;amp;= $Dupes[$x] &amp;amp; &#039;,&#039;&lt;br /&gt;
		Next&lt;br /&gt;
		Return StringTrimRight($s_return, 1)&lt;br /&gt;
	Else&lt;br /&gt;
		Return $Dupes&lt;br /&gt;
	EndIf&lt;br /&gt;
EndFunc   ;==&amp;gt;_SearchForDupes&lt;br /&gt;
&lt;br /&gt;
Func _FindDupe(ByRef $a_array01, ByRef $a_array02, ByRef $Dupes)&lt;br /&gt;
	Local $found = False&lt;br /&gt;
&lt;br /&gt;
	For $i = 0 To UBound($a_array01) - 1&lt;br /&gt;
		For $j = 0 To UBound($a_array02) - 1&lt;br /&gt;
			If $a_array01[$i] = $a_array02[$j] Then&lt;br /&gt;
				$found = False&lt;br /&gt;
&lt;br /&gt;
				For $x = 1 To $Dupes[0]&lt;br /&gt;
					If $Dupes[$x] = $a_array01[$i] Then&lt;br /&gt;
						$found = True&lt;br /&gt;
						ExitLoop&lt;br /&gt;
					EndIf&lt;br /&gt;
				Next&lt;br /&gt;
&lt;br /&gt;
				If Not $found Then&lt;br /&gt;
					$Dupes[0] += 1&lt;br /&gt;
					ReDim $Dupes[$Dupes[0] + 1]&lt;br /&gt;
					$Dupes[$Dupes[0]] = $a_array01[$i]&lt;br /&gt;
				EndIf&lt;br /&gt;
			EndIf&lt;br /&gt;
		Next&lt;br /&gt;
	Next&lt;br /&gt;
EndFunc   ;==&amp;gt;_FindDupe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _Is1DArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;Local $sString = &#039;String&#039;&lt;br /&gt;
Local $a1DArray[2] = [1, &#039;Row_1&#039;]&lt;br /&gt;
Local $a2DArray[2][2] = [[1],[&#039;Row_1: Col_1&#039;, &#039;Row_1: Col_2&#039;]]&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $sString a 1D Array?: &#039; &amp;amp; _Is1DArray($sString) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $a1DArray a 1D Array?: &#039; &amp;amp; _Is1DArray($a1DArray) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $a2DArray a 1D Array?: &#039; &amp;amp; _Is1DArray($a2DArray) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Check if a variable is a 1D Array.&lt;br /&gt;
Func _Is1DArray(ByRef Const $aArray)&lt;br /&gt;
	Return UBound($aArray) And (UBound($aArray, 0) = 1)&lt;br /&gt;
EndFunc   ;==&amp;gt;_Is1DArray&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _Is2DArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
|Desc=Check if a variable is a 2D Array.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;Local $sString = &#039;String&#039;&lt;br /&gt;
Local $a1DArray[2] = [1, &#039;Row_1&#039;]&lt;br /&gt;
Local $a2DArray[2][2] = [[1],[&#039;Row_1: Col_1&#039;, &#039;Row_1: Col_2&#039;]]&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $sString a 1D Array?: &#039; &amp;amp; _Is2DArray($sString) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $a1DArray a 1D Array?: &#039; &amp;amp; _Is2DArray($a1DArray) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $a2DArray a 1D Array?: &#039; &amp;amp; _Is2DArray($a2DArray) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Check if a variable is a 2D Array.&lt;br /&gt;
Func _Is2DArray(ByRef Const $aArray)&lt;br /&gt;
	Return UBound($aArray) And (UBound($aArray, 0) = 2)&lt;br /&gt;
EndFunc   ;==&amp;gt;_Is2DArray&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsInBounds ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;#include &amp;lt;Constants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Local $aArray[5] = [&#039;Item_1&#039;, &#039;Item_2&#039;, &#039;Item_3&#039;, &#039;Item_4&#039;, &#039;Item_5&#039;]&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_IsInBounds($aArray, 1) &amp;amp; @CRLF) ; Returns True as the Array has 5 items.&lt;br /&gt;
ConsoleWrite(_IsInBounds($aArray, 5) &amp;amp; @CRLF) ; Returns False as the Array has 5 items but starts from the 0th index not 1st.&lt;br /&gt;
ConsoleWrite(_IsInBounds($aArray, 0) &amp;amp; @CRLF) ; Returns True.&lt;br /&gt;
&lt;br /&gt;
If _IsInBounds($aArray, 4) Then&lt;br /&gt;
	MsgBox($MB_SYSTEMMODAL, &#039;&#039;, &#039;Position 4 contains the value: &amp;quot;&#039; &amp;amp; $aArray[4] &amp;amp; &#039;&amp;quot;&#039;)&lt;br /&gt;
EndIf&lt;br /&gt;
&lt;br /&gt;
Func _IsInBounds(ByRef Const $aArray, $iIndex)&lt;br /&gt;
	Local $iDim = UBound($aArray, 0)&lt;br /&gt;
	If $iDim &amp;lt; 0 Or $iDim &amp;gt; 2 Then ; If not a 1D or 2D Array, then return -1 and set @error to non-zero.&lt;br /&gt;
		Return SetError(1, 0, False)&lt;br /&gt;
	EndIf&lt;br /&gt;
	Return $iIndex &amp;lt; UBound($aArray, 1)&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsInBounds&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _MultiFileListToArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=4920-valuater&lt;br /&gt;
|AuthorName=Valuater&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Multiple File List to Array&lt;br /&gt;
&lt;br /&gt;
$Files_List = _MultiFileListToArray(@ScriptDir, &amp;quot;*.txt|*.ini&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
; for display only&lt;br /&gt;
$GUI = GUICreate(&amp;quot; _MultiFileListToArray - DEMO&amp;quot;)&lt;br /&gt;
$Edit1 = GUICtrlCreateEdit(&amp;quot;&amp;quot;, 50, 50, 300, 300)&lt;br /&gt;
For $x = 1 To UBound($Files_List) - 1&lt;br /&gt;
    GUICtrlSetData(-1, $Files_List[$x] &amp;amp; @CRLF, 1)&lt;br /&gt;
Next&lt;br /&gt;
GUISetState()&lt;br /&gt;
&lt;br /&gt;
While GUIGetMsg() &amp;lt;&amp;gt; -3&lt;br /&gt;
WEnd&lt;br /&gt;
; end display only&lt;br /&gt;
&lt;br /&gt;
Func _MultiFileListToArray($sPath, $sFilter = &amp;quot;*&amp;quot;, $iFlag = 0)&lt;br /&gt;
    Local $hSearch, $sFile, $asFileList[1], $sCount&lt;br /&gt;
    If Not FileExists($sPath) Then Return SetError(1, 1, &amp;quot;&amp;quot;)&lt;br /&gt;
    If (StringInStr($sFilter, &amp;quot;\&amp;quot;)) Or (StringInStr($sFilter, &amp;quot;/&amp;quot;)) Or (StringInStr($sFilter, &amp;quot;:&amp;quot;)) Or (StringInStr($sFilter, &amp;quot;&amp;gt;&amp;quot;)) Or (StringInStr($sFilter, &amp;quot;&amp;lt;&amp;quot;)) Or (StringStripWS($sFilter, 8) = &amp;quot;&amp;quot;) Then Return SetError(2, 2, &amp;quot;&amp;quot;)&lt;br /&gt;
    $sFilter = (StringSplit($sFilter, &amp;quot;|&amp;quot;))&lt;br /&gt;
    If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, &amp;quot;&amp;quot;)&lt;br /&gt;
    For $sCount = 1 To $sFilter[0]&lt;br /&gt;
        $hSearch = FileFindFirstFile($sPath &amp;amp; &amp;quot;\&amp;quot; &amp;amp; $sFilter[$sCount])&lt;br /&gt;
        If $hSearch = -1 Then&lt;br /&gt;
            If $sCount = $sFilter[0] Then Return SetError(4, 4, $asFileList)&lt;br /&gt;
            ContinueLoop&lt;br /&gt;
        EndIf&lt;br /&gt;
        While 1&lt;br /&gt;
            $sFile = FileFindNextFile($hSearch)&lt;br /&gt;
            If @error Then&lt;br /&gt;
                SetError(0)&lt;br /&gt;
                ExitLoop&lt;br /&gt;
            EndIf&lt;br /&gt;
            If $iFlag = 1 And StringInStr(FileGetAttrib($sPath &amp;amp; &amp;quot;\&amp;quot; &amp;amp; $sFile), &amp;quot;D&amp;quot;) &amp;lt;&amp;gt; 0 Then ContinueLoop&lt;br /&gt;
            If $iFlag = 2 And StringInStr(FileGetAttrib($sPath &amp;amp; &amp;quot;\&amp;quot; &amp;amp; $sFile), &amp;quot;D&amp;quot;) = 0 Then ContinueLoop&lt;br /&gt;
            ReDim $asFileList[UBound($asFileList) + 1]&lt;br /&gt;
            $asFileList[0] = $asFileList[0] + 1&lt;br /&gt;
            $asFileList[UBound($asFileList) - 1] = $sFile&lt;br /&gt;
        WEnd&lt;br /&gt;
        FileClose($hSearch)&lt;br /&gt;
    Next&lt;br /&gt;
    Return $asFileList&lt;br /&gt;
EndFunc   ;==&amp;gt;_MultiFileListToArray&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Return Min or Max Number From One or Two Arrays ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=1967-garyfrost&lt;br /&gt;
|AuthorName=GaryFrost&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Func _MinMaxa($a_nums01, $MaxFlag = 0, $a_nums02 = 0)&lt;br /&gt;
   If Not IsArray($a_nums01) Then&lt;br /&gt;
      SetError(1)&lt;br /&gt;
      Return (0)&lt;br /&gt;
   EndIf&lt;br /&gt;
&lt;br /&gt;
   If @NumParams = 3 Then&lt;br /&gt;
      If Not IsArray($a_nums02) Then&lt;br /&gt;
         SetError(3)&lt;br /&gt;
         Return (0)&lt;br /&gt;
      EndIf&lt;br /&gt;
   EndIf&lt;br /&gt;
&lt;br /&gt;
   Local $idx&lt;br /&gt;
&lt;br /&gt;
   For $idx = 0 To UBound($a_nums01) - 1&lt;br /&gt;
      If StringIsFloat($a_nums01[$idx]) Or StringIsInt($a_nums01[$idx]) Then&lt;br /&gt;
         $a_nums01[$idx] = Number($a_nums01[$idx])&lt;br /&gt;
      Else&lt;br /&gt;
         SetError(2)&lt;br /&gt;
         Return (0)&lt;br /&gt;
      EndIf&lt;br /&gt;
   Next&lt;br /&gt;
&lt;br /&gt;
   _ArraySort($a_nums01, $MaxFlag)&lt;br /&gt;
&lt;br /&gt;
   If @NumParams = 3 Then&lt;br /&gt;
      For $idx = 0 To UBound($a_nums02) - 1&lt;br /&gt;
         If StringIsFloat($a_nums02[$idx]) Or StringIsInt($a_nums02[$idx]) Then&lt;br /&gt;
            $a_nums02[$idx] = Number($a_nums02[$idx])&lt;br /&gt;
         Else&lt;br /&gt;
            SetError(4)&lt;br /&gt;
            Return (0)&lt;br /&gt;
         EndIf&lt;br /&gt;
	  Next&lt;br /&gt;
&lt;br /&gt;
      _ArraySort($a_nums02, $MaxFlag)&lt;br /&gt;
&lt;br /&gt;
	  If $MaxFlag Then&lt;br /&gt;
         If Number($a_nums01[0]) &amp;gt; Number($a_nums02[0]) Then&lt;br /&gt;
            Return $a_nums01[0]&lt;br /&gt;
         Else&lt;br /&gt;
            Return $a_nums02[0]&lt;br /&gt;
         EndIf&lt;br /&gt;
      Else&lt;br /&gt;
         If Number($a_nums01[0]) &amp;lt; Number($a_nums02[0]) Then&lt;br /&gt;
            Return $a_nums01[0]&lt;br /&gt;
         Else&lt;br /&gt;
            Return $a_nums02[0]&lt;br /&gt;
         EndIf&lt;br /&gt;
      EndIf&lt;br /&gt;
   EndIf&lt;br /&gt;
&lt;br /&gt;
   Return $a_nums01[0]&lt;br /&gt;
EndFunc ;==&amp;gt;_MinMaxa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;/div&gt;</summary>
		<author><name>DatMCEyeBall</name></author>
	</entry>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Mouse_%26_Keyboard_)&amp;diff=11916</id>
		<title>Snippets ( AutoIt Mouse &amp; Keyboard )</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Mouse_%26_Keyboard_)&amp;diff=11916"/>
		<updated>2013-08-24T19:15:30Z</updated>

		<summary type="html">&lt;p&gt;DatMCEyeBall: /* _MouseRepel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
[[category:Snippets]]&lt;br /&gt;
&lt;br /&gt;
{{Snippet Credit Header}}&lt;br /&gt;
&lt;br /&gt;
== Control Button by HotKey ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=4813-smoke-n&lt;br /&gt;
|AuthorName=SmOke_N&lt;br /&gt;
|Desc=http://www.autoitscript.com/forum/index.php?s=&amp;amp;showtopic=36564&amp;amp;view=findpost&amp;amp;p=270412&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Control Button by HotKey&lt;br /&gt;
; http://www.autoitscript.com/forum/index.php?s=&amp;amp;showtopic=36564&amp;amp;view=findpost&amp;amp;p=270412&lt;br /&gt;
HotKeySet(&amp;quot;+4&amp;quot;, &amp;quot;_ClickButton&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Global Const $Main = GUICreate(&amp;quot;Some GUI&amp;quot;, 200, 100)&lt;br /&gt;
&lt;br /&gt;
Global Const $Button = GUICtrlCreateButton(&amp;quot;Some Button To Click&amp;quot;, 10, 35, 180, 30)&lt;br /&gt;
&lt;br /&gt;
Global $fClickit&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Switch GUIGetMsg()&lt;br /&gt;
        Case - 3&lt;br /&gt;
            Exit&lt;br /&gt;
        Case $Button&lt;br /&gt;
            If Not $fClickit Then&lt;br /&gt;
                MsgBox(64, &amp;quot;Clicked&amp;quot;, &amp;quot;You clicked the button&amp;quot;)&lt;br /&gt;
            Else&lt;br /&gt;
                $fClickit = Not $fClickit&lt;br /&gt;
                MsgBox(64, &amp;quot;Clicked&amp;quot;, &amp;quot;You used a hotkey to click the button&amp;quot;)&lt;br /&gt;
            EndIf&lt;br /&gt;
    EndSwitch&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func _ClickButton()&lt;br /&gt;
    $fClickit = Not $fClickit&lt;br /&gt;
    ControlClick(HWnd($Main), &#039;&#039;, $Button)&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ControlMouseClick ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=58637-fett8802&lt;br /&gt;
|AuthorName=fett8802&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; #FUNCTION# ====================================================================================================================&lt;br /&gt;
; Name...........: _ControlMouseClick&lt;br /&gt;
; Description ...: Use the mouse to move to a control and click it&lt;br /&gt;
; Syntax.........: _ControlMouseClick($iTitle, $iText, $iControl [, $iButton = &amp;quot;left&amp;quot; [, $iClicks = &amp;quot;1&amp;quot; [, $iSpeed = &amp;quot;10&amp;quot; [, $iXpos = &#039;&#039; [, $iYpos = &#039;&#039; ]]]]] )&lt;br /&gt;
; Parameters ....: $iTitle  - The title of the window containing the control&lt;br /&gt;
;      $iText  - Some text from the window containing the control. Can enter no text be using &#039;&#039;&lt;br /&gt;
;      $iControl - The Control ID of the control to click&lt;br /&gt;
;      $iButton  - [optional] The button to click: &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;middle&amp;quot;, &amp;quot;main&amp;quot;, &amp;quot;menu&amp;quot;, &amp;quot;primary&amp;quot;, &amp;quot;secondary&amp;quot;. Default is &amp;quot;left&amp;quot;&lt;br /&gt;
;      $iClicks  - [optional] The number of times to click the mouse. Default is 1.&lt;br /&gt;
;      $iSpeed  - [optional] The speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.&lt;br /&gt;
;      $iXpos  - [optional] The x position to click within the control. Default is center.&lt;br /&gt;
;      $iYpos  - [optional] The y position to click within the control. Default is center.&lt;br /&gt;
; Author ........: Kris Mills &amp;lt;fett8802 at gmail dot com&amp;gt;&lt;br /&gt;
; UserCallTip....: _ControlMouseClick ( &amp;quot;title&amp;quot;, &amp;quot;text&amp;quot;, controlID [, button [, clicks [, speed [, x [, y ]]]]] ) Use the mouse to move to a control and click it.(required: #include &amp;lt;KrisUDF.au3&amp;gt;)&lt;br /&gt;
; ===============================================================================================================================&lt;br /&gt;
Func _ControlMouseClick($iTitle, $iText, $iControl, $iButton = &amp;quot;left&amp;quot;, $iClicks = &amp;quot;1&amp;quot;, $iSpeed = &amp;quot;10&amp;quot;, $iXpos = &#039;&#039;, $iYpos = &#039;&#039;)&lt;br /&gt;
	$iOriginal = Opt(&amp;quot;MouseCoordMode&amp;quot;, 2) ;Change the MouseCoordMode to relative coords and get the previous setting&lt;br /&gt;
	$aPos = ControlGetPos($iTitle, $iText, $iControl) ;Get the position of the given control&lt;br /&gt;
	MouseClick($iButton, $aPos[0] + ($aPos[2] / 2) + $iXpos, $aPos[1] + ($aPos[3] / 2) + $iYpos, $iClicks, $iSpeed) ;Move the mouse and click on the given control&lt;br /&gt;
	Opt(&amp;quot;MouseCoordMode&amp;quot;, $iOriginal) ;Change the MouseCoordMode back to the original&lt;br /&gt;
EndFunc   ;==&amp;gt;_ControlMouseClick&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Get Mouse Position ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=33528-shmuelw1&lt;br /&gt;
|AuthorName=shmuelw1&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; This script returns the current mouse position&lt;br /&gt;
; Edit the value of $mode as required&lt;br /&gt;
#include &amp;lt;Misc.au3&amp;gt; ; required for _IsPressed&lt;br /&gt;
&lt;br /&gt;
Global $mode = 0 ; this sets the MouseCoordMode - see Opt(&amp;quot;MouseCoordMode&amp;quot; later in the script&lt;br /&gt;
Global $modeText&lt;br /&gt;
Global $pos&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;MouseCoordMode&amp;quot;, $mode) ; 1 = absolute screen position, 0 = relative to active windows, 2 = relative to client area&lt;br /&gt;
Opt(&amp;quot;TrayIconDebug&amp;quot;, 1)&lt;br /&gt;
&lt;br /&gt;
Switch $mode&lt;br /&gt;
    Case 0&lt;br /&gt;
        $modeText = &amp;quot;relative to the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
    Case 1&lt;br /&gt;
        $modeText = &amp;quot;from the top-right of the screen is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
    Case 2&lt;br /&gt;
        $modeText = &amp;quot;relative to the client area of the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
EndSwitch&lt;br /&gt;
&lt;br /&gt;
ToolTip(&amp;quot;Move the pointer to the desired location. Press Enter to continue.&amp;quot;, @DesktopWidth/2-250, @DesktopHeight/2-10)&lt;br /&gt;
&lt;br /&gt;
While Not _IsPressed(&amp;quot;0D&amp;quot;) ; wait for Enter key&lt;br /&gt;
    Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
ToolTip(&#039;&#039;) ; close ToolTip&lt;br /&gt;
&lt;br /&gt;
$pos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
MsgBox(0, &amp;quot;Mouse Position&amp;quot;, &amp;quot;The mouse position &amp;quot; &amp;amp; $modeText &amp;amp; $pos[0] &amp;amp; &amp;quot;,&amp;quot; &amp;amp; $pos[1] &amp;amp; &amp;quot; (x,y)&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Get Mouse Position With Hotkey ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=33528-shmuelw1&lt;br /&gt;
|AuthorName=shmuelw1&lt;br /&gt;
|Desc=This script returns the current mouse position&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; 2013/08/24 20:58 PM -&amp;gt; Code tidied by DatMCEyeBall&lt;br /&gt;
&lt;br /&gt;
; This script returns the current mouse position&lt;br /&gt;
; Edit the value of $mode as required&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Misc.au3&amp;gt; ; required for _IsPressed&lt;br /&gt;
&lt;br /&gt;
Global $mode = 0 ; this sets the MouseCoordMode - see Opt(&amp;quot;MouseCoordMode&amp;quot; later in the script&lt;br /&gt;
Global $modeText&lt;br /&gt;
Global $pos&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;MouseCoordMode&amp;quot;, $mode) ;1=absolute screen position, 0=relative to active windows, 2= relative to client area&lt;br /&gt;
Opt(&amp;quot;TrayIconDebug&amp;quot;, 1)&lt;br /&gt;
&lt;br /&gt;
HotKeySet(&amp;quot;^#s&amp;quot;, &amp;quot;_GetPosition&amp;quot;) ; ! = ALT keystroke, + = SHIFT, ^ = CONTROL, # = Windows key&lt;br /&gt;
&lt;br /&gt;
Switch $mode&lt;br /&gt;
	Case 0&lt;br /&gt;
		$modeText = &amp;quot;relative to the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
	Case 1&lt;br /&gt;
		$modeText = &amp;quot;from the top-right of the screen is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
	Case 2&lt;br /&gt;
		$modeText = &amp;quot;relative to the client area of the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
EndSwitch&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
	Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func _GetPosition()&lt;br /&gt;
	ToolTip(&amp;quot;Move the pointer to the desired location. Press Enter to continue.&amp;quot;, @DesktopWidth / 2 - 250, @DesktopHeight / 2 - 10)&lt;br /&gt;
&lt;br /&gt;
	While Not _IsPressed(&amp;quot;0D&amp;quot;) ; wait for Enter key&lt;br /&gt;
		Sleep(100)&lt;br /&gt;
	WEnd&lt;br /&gt;
&lt;br /&gt;
	ToolTip(&#039;&#039;) ; close ToolTip&lt;br /&gt;
&lt;br /&gt;
	$pos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
	MsgBox(0, &amp;quot;Mouse Position&amp;quot;, &amp;quot;The mouse position &amp;quot; &amp;amp; $modeText &amp;amp; $pos[0] &amp;amp; &amp;quot;,&amp;quot; &amp;amp; $pos[1] &amp;amp; &amp;quot; (x,y)&amp;quot;)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetPosition&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsLeftHandedMouse ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite( _IsLeftHandedMouse() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _IsLeftHandedMouse()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_SWAPBUTTON) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsLeftHandedMouse&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsRightHandedMouse ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MsgBox(64, &amp;quot;_IsRightHandedMouse()&amp;quot;, _IsRightHandedMouse())&lt;br /&gt;
&lt;br /&gt;
Func _IsRightHandedMouse()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_SWAPBUTTON) = 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsRightHandedMouse&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Is Mouse Over GUI ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=20477-mrcreator&lt;br /&gt;
|AuthorName=MrCreatoR&lt;br /&gt;
|ModifierURL=4920-valuater&lt;br /&gt;
|ModifierName=Valuater&lt;br /&gt;
|Desc=Check if Mouse is over a GUI&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check if Mouse is over a GUI&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;GUIConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $ParentWin = GUICreate(&amp;quot;GetHoveredHwnd&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    If GUIGetMsg() = -3 Then Exit&lt;br /&gt;
&lt;br /&gt;
    If GetHoveredHwnd() = $ParentWin Then&lt;br /&gt;
        ToolTip(&amp;quot;You are over the GUI&amp;quot;)&lt;br /&gt;
    Else&lt;br /&gt;
        ToolTip(&#039;&#039;)&lt;br /&gt;
    EndIf&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func GetHoveredHwnd()&lt;br /&gt;
    Local $iRet = DllCall(&amp;quot;user32.dll&amp;quot;, &amp;quot;int&amp;quot;, &amp;quot;WindowFromPoint&amp;quot;, &amp;quot;long&amp;quot;, MouseGetPos(0), &amp;quot;long&amp;quot;, MouseGetPos(1))&lt;br /&gt;
    If IsArray($iRet) Then Return HWnd($iRet[0])&lt;br /&gt;
    Return SetError(1, 0, 0)&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsMouseInstalled ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MsgBox(64, &amp;quot;_IsMouseInstalled()&amp;quot;, _IsMouseInstalled())&lt;br /&gt;
&lt;br /&gt;
Func _IsMouseInstalled()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_CMOUSEBUTTONS) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsMouseInstalled&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsMouseWheelPresent ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_IsMouseWheelPresent() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _IsMouseWheelPresent()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_MOUSEWHEELPRESENT) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsMouseWheelPresent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _MouseRepel ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=6946-the-kandie-man&lt;br /&gt;
|AuthorName=The Kandie Man&lt;br /&gt;
|ModifierURL=79729-datmceyeball&lt;br /&gt;
|ModifierName=DatMCEyeBall&lt;br /&gt;
|Desc=Mouse repel - keep mouse away from an area&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; GUI snap to corners&lt;br /&gt;
; Mouse repel - keep mouse away from an area&lt;br /&gt;
; Author - The Kandie Man&lt;br /&gt;
; 2013/08/24 21:11 PM -&amp;gt; Modified for GUI, left in the AdlibRegister for non-GUI uses -&amp;gt; DatMCEyeBall.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt; ;For the $WM_NOTIFY const.&lt;br /&gt;
&lt;br /&gt;
Global Const $GUI = GUICreate(&amp;quot;Can&#039;t Touch This&amp;quot;, 200, 100, 200, 200)&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
; AdlibRegister(&amp;quot;CallMouseRepel&amp;quot;, 10) ; Use for non-GUI purposes.&lt;br /&gt;
GUIRegisterMsg($WM_MOUSEMOVE, &amp;quot;CallMouseRepel&amp;quot;) ;Cleaner way of doing it for a GUI.&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    $nMsg = GUIGetMsg()&lt;br /&gt;
    If $nMsg = -3 Then Exit&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func CallMouseRepel()&lt;br /&gt;
    Local Const $coords = WinGetPos($GUI)&lt;br /&gt;
    _MouseRepel($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3])&lt;br /&gt;
EndFunc   ;==&amp;gt;CallMouseRepel&lt;br /&gt;
&lt;br /&gt;
;===============================================================================&lt;br /&gt;
; Description:    _MouseRepel&lt;br /&gt;
; Parameter(s):   $i_left - Left coord&lt;br /&gt;
;                 $i_top - Top coord&lt;br /&gt;
;                 $i_right - Right coord&lt;br /&gt;
;                 $i_bottom - Bottom coord&lt;br /&gt;
; User CallTip:   _MouseRepel([$i_left = 0[, $i_top = 0[, $i_right = 0[, $i_bottom = 0]]]]) Repel the Mouse Cursor to specified coords.&lt;br /&gt;
; Author(s):      The Kandie Man&lt;br /&gt;
; Note(s):        This function must be called constantly to prevent the mouse cursor from entering the area.&lt;br /&gt;
;                 It is therefore recommended that you call this function from another function that is called by AdlibEnable every 1 to 50ms.&lt;br /&gt;
;===============================================================================&lt;br /&gt;
Func _MouseRepel($i_left = 0, $i_top = 0, $i_right = 0, $i_bottom = 0)&lt;br /&gt;
    Local $a_MousePos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
    Local $i_XCordinate = -1, $i_YCordinate = -1&lt;br /&gt;
&lt;br /&gt;
    If $a_MousePos[0] &amp;gt;= $i_left And $a_MousePos[0] &amp;lt;= $i_right Then&lt;br /&gt;
        If ($a_MousePos[0] - $i_left) &amp;lt; ($i_right - $a_MousePos[0]) Then&lt;br /&gt;
            $i_XCordinate = $i_left - 1&lt;br /&gt;
        Else&lt;br /&gt;
            $i_XCordinate = $i_right + 1&lt;br /&gt;
        EndIf&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    If $a_MousePos[1] &amp;gt;= $i_top And $a_MousePos[1] &amp;lt;= $i_bottom Then&lt;br /&gt;
        If ($a_MousePos[1] - $i_top) &amp;lt; ($i_bottom - $a_MousePos[1]) Then&lt;br /&gt;
            $i_YCordinate = $i_top - 1&lt;br /&gt;
        Else&lt;br /&gt;
            $i_YCordinate = $i_bottom + 1&lt;br /&gt;
        EndIf&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    If $i_XCordinate &amp;lt;&amp;gt; -1 And $i_YCordinate &amp;lt;&amp;gt; -1 Then&lt;br /&gt;
        If Abs($i_XCordinate - $a_MousePos[0]) &amp;gt; Abs($i_YCordinate - $a_MousePos[1]) Then&lt;br /&gt;
            MouseMove($a_MousePos[0], $i_YCordinate, 1)&lt;br /&gt;
        ElseIf Abs($i_XCordinate - $a_MousePos[0]) &amp;lt; Abs($i_YCordinate - $a_MousePos[1]) Then&lt;br /&gt;
            MouseMove($i_XCordinate, $a_MousePos[1], 1)&lt;br /&gt;
        Else&lt;br /&gt;
            MouseMove($i_XCordinate, $i_YCordinate, 1)&lt;br /&gt;
        EndIf&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc   ;==&amp;gt;_MouseRepel&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _MyMouseMove ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=3602-martin&lt;br /&gt;
|AuthorName=martin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Work with any screen resolution&lt;br /&gt;
; This is for the 1440 x 900 screen - change as needed&lt;br /&gt;
&lt;br /&gt;
Global Const $iHeight = 900&lt;br /&gt;
Global Const $iWidth = 1440&lt;br /&gt;
&lt;br /&gt;
_MyMouseMove(100, 200)&lt;br /&gt;
&lt;br /&gt;
Func _MyMouseMove($iX, $iY)&lt;br /&gt;
	Return MouseMove(@DesktopWidth * $iX / $iWidth, @DesktopHeight * $iY / $iHeight)&lt;br /&gt;
EndFunc   ;==&amp;gt;_MyMouseMove&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Restricted Input Keys - All USB Devices ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorName=Multiple Authors&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $iInput = 99&lt;br /&gt;
&lt;br /&gt;
; Restricted keys in an input &amp;quot;[\/:*?&amp;quot;&amp;lt;&amp;gt;\|]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
	Local Const $hGUI = GUICreate(&amp;quot;Input Filter&amp;quot;, 300, 30, -1, -1)&lt;br /&gt;
&lt;br /&gt;
	$iInput = GUICtrlCreateInput(&#039;&#039;, 5, 5, 290)&lt;br /&gt;
&lt;br /&gt;
	GUIRegisterMsg($WM_COMMAND, &amp;quot;WM_COMMAND&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	GUISetState(@SW_SHOWNORMAL, $hGUI)&lt;br /&gt;
&lt;br /&gt;
	While 1&lt;br /&gt;
		Switch GUIGetMsg()&lt;br /&gt;
			Case $GUI_EVENT_CLOSE&lt;br /&gt;
				ExitLoop&lt;br /&gt;
		EndSwitch&lt;br /&gt;
	WEnd&lt;br /&gt;
&lt;br /&gt;
	GUIDelete($hGUI)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)&lt;br /&gt;
	#forceref $hWnd, $iMsg, $wParam, $lParam&lt;br /&gt;
	Return GUICtrlSetData($iInput, StringRegExpReplace(GUICtrlRead($iInput), &#039;[\\/ :* ?&amp;quot;&amp;lt;&amp;gt;\|]&#039;, &#039;&#039;))&lt;br /&gt;
EndFunc   ;==&amp;gt;WM_COMMAND&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Two Tray Mouse Menus ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=13029-smashly&lt;br /&gt;
|AuthorName=smashly&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Two Tray Menus - Right &amp;amp; Left Click On Icon&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Constants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;TrayOnEventMode&amp;quot;,1)&lt;br /&gt;
Opt(&amp;quot;TrayMenuMode&amp;quot;,1)&lt;br /&gt;
&lt;br /&gt;
TraySetClick(18)&lt;br /&gt;
&lt;br /&gt;
Global $Tray[11], $state = 2&lt;br /&gt;
&lt;br /&gt;
TrayCreateItem(&#039;&#039;)&lt;br /&gt;
TrayCreateItem(&amp;quot;Exit&amp;quot;)&lt;br /&gt;
TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, &amp;quot;TrayMenuLeftClick&amp;quot;)&lt;br /&gt;
TraySetOnEvent($TRAY_EVENT_SECONDARYDOWN, &amp;quot;TrayMenuRightClick&amp;quot;)&lt;br /&gt;
TraySetState()&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func TrayMenuLeftClick()&lt;br /&gt;
    If $state = 0 Or $state = 2 Then&lt;br /&gt;
        $state = 1&lt;br /&gt;
        For $i = 6 to 10&lt;br /&gt;
            TrayItemDelete($Tray[$i])&lt;br /&gt;
        Next&lt;br /&gt;
        For $i = 1 to 5&lt;br /&gt;
            $Tray[$i] = TrayCreateItem(&amp;quot;1st Menu Item - &amp;quot; &amp;amp; $i, -1, $i -1 )&lt;br /&gt;
            TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
        Next&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&lt;br /&gt;
Func TrayMenuRightClick()&lt;br /&gt;
    If $state = 1 Or $state = 2 Then&lt;br /&gt;
        $state = 0&lt;br /&gt;
        For $i = 1 to 5&lt;br /&gt;
            TrayItemDelete($Tray[$i])&lt;br /&gt;
        Next&lt;br /&gt;
        For $i = 6 to 10&lt;br /&gt;
            $Tray[$i] = TrayCreateItem(&amp;quot;2nd Menu Item - &amp;quot; &amp;amp; $i - 5, -1, $i - 6)&lt;br /&gt;
            TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
        Next&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&lt;br /&gt;
Func TrayEvent()&lt;br /&gt;
    MsgBox(0, &#039;&#039;, TrayItemGetText(@TRAY_ID))&lt;br /&gt;
    If TrayItemGetText(@TRAY_ID) = &amp;quot;Exit&amp;quot; Then Exit&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _WinAPI_SwapMouseButton ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
    ; Swap the left button to generate right-button messages and vice versa.&lt;br /&gt;
    ConsoleWrite(_WinAPI_SwapMouseButton(True) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
    ; Wait for the user to see the changes.&lt;br /&gt;
    Sleep(10000)&lt;br /&gt;
&lt;br /&gt;
    ; Change the mouse buttons back to their original meanings.&lt;br /&gt;
    ConsoleWrite(_WinAPI_SwapMouseButton(False) &amp;amp; @CRLF)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
; If $fFlag is True, the left button generates right-button messages and the right button generates left-button messages.&lt;br /&gt;
; If $fFlag is False, the buttons are restored to their original meanings.&lt;br /&gt;
Func _WinAPI_SwapMouseButton($fFlag)&lt;br /&gt;
    Local $aReturn = DllCall(&#039;user32.dll&#039;, &#039;int&#039;, &#039;SwapMouseButton&#039;, &#039;int&#039;, $fFlag)&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(1, 0, 0)&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return $aReturn[0]&lt;br /&gt;
EndFunc   ;==&amp;gt;_WinAPI_SwapMouseButton&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;/div&gt;</summary>
		<author><name>DatMCEyeBall</name></author>
	</entry>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Mouse_%26_Keyboard_)&amp;diff=11915</id>
		<title>Snippets ( AutoIt Mouse &amp; Keyboard )</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Mouse_%26_Keyboard_)&amp;diff=11915"/>
		<updated>2013-08-24T19:14:15Z</updated>

		<summary type="html">&lt;p&gt;DatMCEyeBall: /* _MouseRepel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
[[category:Snippets]]&lt;br /&gt;
&lt;br /&gt;
{{Snippet Credit Header}}&lt;br /&gt;
&lt;br /&gt;
== Control Button by HotKey ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=4813-smoke-n&lt;br /&gt;
|AuthorName=SmOke_N&lt;br /&gt;
|Desc=http://www.autoitscript.com/forum/index.php?s=&amp;amp;showtopic=36564&amp;amp;view=findpost&amp;amp;p=270412&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Control Button by HotKey&lt;br /&gt;
; http://www.autoitscript.com/forum/index.php?s=&amp;amp;showtopic=36564&amp;amp;view=findpost&amp;amp;p=270412&lt;br /&gt;
HotKeySet(&amp;quot;+4&amp;quot;, &amp;quot;_ClickButton&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Global Const $Main = GUICreate(&amp;quot;Some GUI&amp;quot;, 200, 100)&lt;br /&gt;
&lt;br /&gt;
Global Const $Button = GUICtrlCreateButton(&amp;quot;Some Button To Click&amp;quot;, 10, 35, 180, 30)&lt;br /&gt;
&lt;br /&gt;
Global $fClickit&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Switch GUIGetMsg()&lt;br /&gt;
        Case - 3&lt;br /&gt;
            Exit&lt;br /&gt;
        Case $Button&lt;br /&gt;
            If Not $fClickit Then&lt;br /&gt;
                MsgBox(64, &amp;quot;Clicked&amp;quot;, &amp;quot;You clicked the button&amp;quot;)&lt;br /&gt;
            Else&lt;br /&gt;
                $fClickit = Not $fClickit&lt;br /&gt;
                MsgBox(64, &amp;quot;Clicked&amp;quot;, &amp;quot;You used a hotkey to click the button&amp;quot;)&lt;br /&gt;
            EndIf&lt;br /&gt;
    EndSwitch&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func _ClickButton()&lt;br /&gt;
    $fClickit = Not $fClickit&lt;br /&gt;
    ControlClick(HWnd($Main), &#039;&#039;, $Button)&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ControlMouseClick ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=58637-fett8802&lt;br /&gt;
|AuthorName=fett8802&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; #FUNCTION# ====================================================================================================================&lt;br /&gt;
; Name...........: _ControlMouseClick&lt;br /&gt;
; Description ...: Use the mouse to move to a control and click it&lt;br /&gt;
; Syntax.........: _ControlMouseClick($iTitle, $iText, $iControl [, $iButton = &amp;quot;left&amp;quot; [, $iClicks = &amp;quot;1&amp;quot; [, $iSpeed = &amp;quot;10&amp;quot; [, $iXpos = &#039;&#039; [, $iYpos = &#039;&#039; ]]]]] )&lt;br /&gt;
; Parameters ....: $iTitle  - The title of the window containing the control&lt;br /&gt;
;      $iText  - Some text from the window containing the control. Can enter no text be using &#039;&#039;&lt;br /&gt;
;      $iControl - The Control ID of the control to click&lt;br /&gt;
;      $iButton  - [optional] The button to click: &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;middle&amp;quot;, &amp;quot;main&amp;quot;, &amp;quot;menu&amp;quot;, &amp;quot;primary&amp;quot;, &amp;quot;secondary&amp;quot;. Default is &amp;quot;left&amp;quot;&lt;br /&gt;
;      $iClicks  - [optional] The number of times to click the mouse. Default is 1.&lt;br /&gt;
;      $iSpeed  - [optional] The speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.&lt;br /&gt;
;      $iXpos  - [optional] The x position to click within the control. Default is center.&lt;br /&gt;
;      $iYpos  - [optional] The y position to click within the control. Default is center.&lt;br /&gt;
; Author ........: Kris Mills &amp;lt;fett8802 at gmail dot com&amp;gt;&lt;br /&gt;
; UserCallTip....: _ControlMouseClick ( &amp;quot;title&amp;quot;, &amp;quot;text&amp;quot;, controlID [, button [, clicks [, speed [, x [, y ]]]]] ) Use the mouse to move to a control and click it.(required: #include &amp;lt;KrisUDF.au3&amp;gt;)&lt;br /&gt;
; ===============================================================================================================================&lt;br /&gt;
Func _ControlMouseClick($iTitle, $iText, $iControl, $iButton = &amp;quot;left&amp;quot;, $iClicks = &amp;quot;1&amp;quot;, $iSpeed = &amp;quot;10&amp;quot;, $iXpos = &#039;&#039;, $iYpos = &#039;&#039;)&lt;br /&gt;
	$iOriginal = Opt(&amp;quot;MouseCoordMode&amp;quot;, 2) ;Change the MouseCoordMode to relative coords and get the previous setting&lt;br /&gt;
	$aPos = ControlGetPos($iTitle, $iText, $iControl) ;Get the position of the given control&lt;br /&gt;
	MouseClick($iButton, $aPos[0] + ($aPos[2] / 2) + $iXpos, $aPos[1] + ($aPos[3] / 2) + $iYpos, $iClicks, $iSpeed) ;Move the mouse and click on the given control&lt;br /&gt;
	Opt(&amp;quot;MouseCoordMode&amp;quot;, $iOriginal) ;Change the MouseCoordMode back to the original&lt;br /&gt;
EndFunc   ;==&amp;gt;_ControlMouseClick&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Get Mouse Position ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=33528-shmuelw1&lt;br /&gt;
|AuthorName=shmuelw1&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; This script returns the current mouse position&lt;br /&gt;
; Edit the value of $mode as required&lt;br /&gt;
#include &amp;lt;Misc.au3&amp;gt; ; required for _IsPressed&lt;br /&gt;
&lt;br /&gt;
Global $mode = 0 ; this sets the MouseCoordMode - see Opt(&amp;quot;MouseCoordMode&amp;quot; later in the script&lt;br /&gt;
Global $modeText&lt;br /&gt;
Global $pos&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;MouseCoordMode&amp;quot;, $mode) ; 1 = absolute screen position, 0 = relative to active windows, 2 = relative to client area&lt;br /&gt;
Opt(&amp;quot;TrayIconDebug&amp;quot;, 1)&lt;br /&gt;
&lt;br /&gt;
Switch $mode&lt;br /&gt;
    Case 0&lt;br /&gt;
        $modeText = &amp;quot;relative to the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
    Case 1&lt;br /&gt;
        $modeText = &amp;quot;from the top-right of the screen is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
    Case 2&lt;br /&gt;
        $modeText = &amp;quot;relative to the client area of the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
EndSwitch&lt;br /&gt;
&lt;br /&gt;
ToolTip(&amp;quot;Move the pointer to the desired location. Press Enter to continue.&amp;quot;, @DesktopWidth/2-250, @DesktopHeight/2-10)&lt;br /&gt;
&lt;br /&gt;
While Not _IsPressed(&amp;quot;0D&amp;quot;) ; wait for Enter key&lt;br /&gt;
    Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
ToolTip(&#039;&#039;) ; close ToolTip&lt;br /&gt;
&lt;br /&gt;
$pos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
MsgBox(0, &amp;quot;Mouse Position&amp;quot;, &amp;quot;The mouse position &amp;quot; &amp;amp; $modeText &amp;amp; $pos[0] &amp;amp; &amp;quot;,&amp;quot; &amp;amp; $pos[1] &amp;amp; &amp;quot; (x,y)&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Get Mouse Position With Hotkey ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=33528-shmuelw1&lt;br /&gt;
|AuthorName=shmuelw1&lt;br /&gt;
|Desc=This script returns the current mouse position&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; 2013/08/24 20:58 PM -&amp;gt; Code tidied by DatMCEyeBall&lt;br /&gt;
&lt;br /&gt;
; This script returns the current mouse position&lt;br /&gt;
; Edit the value of $mode as required&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Misc.au3&amp;gt; ; required for _IsPressed&lt;br /&gt;
&lt;br /&gt;
Global $mode = 0 ; this sets the MouseCoordMode - see Opt(&amp;quot;MouseCoordMode&amp;quot; later in the script&lt;br /&gt;
Global $modeText&lt;br /&gt;
Global $pos&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;MouseCoordMode&amp;quot;, $mode) ;1=absolute screen position, 0=relative to active windows, 2= relative to client area&lt;br /&gt;
Opt(&amp;quot;TrayIconDebug&amp;quot;, 1)&lt;br /&gt;
&lt;br /&gt;
HotKeySet(&amp;quot;^#s&amp;quot;, &amp;quot;_GetPosition&amp;quot;) ; ! = ALT keystroke, + = SHIFT, ^ = CONTROL, # = Windows key&lt;br /&gt;
&lt;br /&gt;
Switch $mode&lt;br /&gt;
	Case 0&lt;br /&gt;
		$modeText = &amp;quot;relative to the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
	Case 1&lt;br /&gt;
		$modeText = &amp;quot;from the top-right of the screen is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
	Case 2&lt;br /&gt;
		$modeText = &amp;quot;relative to the client area of the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
EndSwitch&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
	Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func _GetPosition()&lt;br /&gt;
	ToolTip(&amp;quot;Move the pointer to the desired location. Press Enter to continue.&amp;quot;, @DesktopWidth / 2 - 250, @DesktopHeight / 2 - 10)&lt;br /&gt;
&lt;br /&gt;
	While Not _IsPressed(&amp;quot;0D&amp;quot;) ; wait for Enter key&lt;br /&gt;
		Sleep(100)&lt;br /&gt;
	WEnd&lt;br /&gt;
&lt;br /&gt;
	ToolTip(&#039;&#039;) ; close ToolTip&lt;br /&gt;
&lt;br /&gt;
	$pos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
	MsgBox(0, &amp;quot;Mouse Position&amp;quot;, &amp;quot;The mouse position &amp;quot; &amp;amp; $modeText &amp;amp; $pos[0] &amp;amp; &amp;quot;,&amp;quot; &amp;amp; $pos[1] &amp;amp; &amp;quot; (x,y)&amp;quot;)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetPosition&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsLeftHandedMouse ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite( _IsLeftHandedMouse() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _IsLeftHandedMouse()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_SWAPBUTTON) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsLeftHandedMouse&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsRightHandedMouse ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MsgBox(64, &amp;quot;_IsRightHandedMouse()&amp;quot;, _IsRightHandedMouse())&lt;br /&gt;
&lt;br /&gt;
Func _IsRightHandedMouse()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_SWAPBUTTON) = 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsRightHandedMouse&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Is Mouse Over GUI ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=20477-mrcreator&lt;br /&gt;
|AuthorName=MrCreatoR&lt;br /&gt;
|ModifierURL=4920-valuater&lt;br /&gt;
|ModifierName=Valuater&lt;br /&gt;
|Desc=Check if Mouse is over a GUI&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check if Mouse is over a GUI&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;GUIConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $ParentWin = GUICreate(&amp;quot;GetHoveredHwnd&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    If GUIGetMsg() = -3 Then Exit&lt;br /&gt;
&lt;br /&gt;
    If GetHoveredHwnd() = $ParentWin Then&lt;br /&gt;
        ToolTip(&amp;quot;You are over the GUI&amp;quot;)&lt;br /&gt;
    Else&lt;br /&gt;
        ToolTip(&#039;&#039;)&lt;br /&gt;
    EndIf&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func GetHoveredHwnd()&lt;br /&gt;
    Local $iRet = DllCall(&amp;quot;user32.dll&amp;quot;, &amp;quot;int&amp;quot;, &amp;quot;WindowFromPoint&amp;quot;, &amp;quot;long&amp;quot;, MouseGetPos(0), &amp;quot;long&amp;quot;, MouseGetPos(1))&lt;br /&gt;
    If IsArray($iRet) Then Return HWnd($iRet[0])&lt;br /&gt;
    Return SetError(1, 0, 0)&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsMouseInstalled ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MsgBox(64, &amp;quot;_IsMouseInstalled()&amp;quot;, _IsMouseInstalled())&lt;br /&gt;
&lt;br /&gt;
Func _IsMouseInstalled()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_CMOUSEBUTTONS) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsMouseInstalled&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsMouseWheelPresent ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_IsMouseWheelPresent() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _IsMouseWheelPresent()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_MOUSEWHEELPRESENT) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsMouseWheelPresent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _MouseRepel ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=6946-the-kandie-man&lt;br /&gt;
|AuthorName=The Kandie Man&lt;br /&gt;
|ModifierURL=79729-datmceyeball&lt;br /&gt;
|ModifierName=DatMCEyeBall&lt;br /&gt;
|Desc=Mouse repel - keep mouse away from an area&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; GUI snap to corners&lt;br /&gt;
; Mouse repel - keep mouse away from an area&lt;br /&gt;
; Author - The Kandie Man&lt;br /&gt;
; 2013/08/24 21:11 PM -&amp;gt; Modified for GUI, left in the AdlibRegister for non-GUI uses -&amp;gt; DatMCEyeBall.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt; ;For the $WM_NOTIFY const.&lt;br /&gt;
&lt;br /&gt;
Global Const $GUI = GUICreate(&amp;quot;Can&#039;t Touch This&amp;quot;, 200, 100, 200, 200)&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
; AdlibRegister(&amp;quot;CallMouseRepel&amp;quot;, 10) ; Use for non-GUI purposes.&lt;br /&gt;
GUIRegisterMsg($WM_MOUSEMOVE, &amp;quot;CallMouseRepel&amp;quot;) ;Cleaner way of doing it for a GUI.&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
	$nMsg = GUIGetMsg()&lt;br /&gt;
	If $nMsg = -3 Then Exit&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func CallMouseRepel()&lt;br /&gt;
	Local Const $coords = WinGetPos($GUI)&lt;br /&gt;
	_MouseRepel($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3])&lt;br /&gt;
EndFunc   ;==&amp;gt;CallMouseRepel&lt;br /&gt;
&lt;br /&gt;
;===============================================================================&lt;br /&gt;
; Description:    _MouseRepel&lt;br /&gt;
; Parameter(s):   $i_left - Left coord&lt;br /&gt;
;                 $i_top - Top coord&lt;br /&gt;
;                 $i_right - Right coord&lt;br /&gt;
;                 $i_bottom - Bottom coord&lt;br /&gt;
; User CallTip:   _MouseRepel([$i_left = 0[, $i_top = 0[, $i_right = 0[, $i_bottom = 0]]]]) Repel the Mouse Cursor to specified coords.&lt;br /&gt;
; Author(s):      The Kandie Man&lt;br /&gt;
; Note(s):        This function must be called constantly to prevent the mouse cursor from entering the area.&lt;br /&gt;
;                 It is therefore recommended that you call this function from another function that is called by AdlibEnable every 1 to 50ms.&lt;br /&gt;
;===============================================================================&lt;br /&gt;
Func _MouseRepel($i_left = 0, $i_top = 0, $i_right = 0, $i_bottom = 0)&lt;br /&gt;
	Local $a_MousePos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
	Local $i_XCordinate = -1, $i_YCordinate = -1&lt;br /&gt;
&lt;br /&gt;
	If $a_MousePos[0] &amp;gt;= $i_left And $a_MousePos[0] &amp;lt;= $i_right Then&lt;br /&gt;
		If ($a_MousePos[0] - $i_left) &amp;lt; ($i_right - $a_MousePos[0]) Then&lt;br /&gt;
			$i_XCordinate = $i_left - 1&lt;br /&gt;
		Else&lt;br /&gt;
			$i_XCordinate = $i_right + 1&lt;br /&gt;
		EndIf&lt;br /&gt;
	EndIf&lt;br /&gt;
&lt;br /&gt;
	If $a_MousePos[1] &amp;gt;= $i_top And $a_MousePos[1] &amp;lt;= $i_bottom Then&lt;br /&gt;
		If ($a_MousePos[1] - $i_top) &amp;lt; ($i_bottom - $a_MousePos[1]) Then&lt;br /&gt;
			$i_YCordinate = $i_top - 1&lt;br /&gt;
		Else&lt;br /&gt;
			$i_YCordinate = $i_bottom + 1&lt;br /&gt;
		EndIf&lt;br /&gt;
	EndIf&lt;br /&gt;
&lt;br /&gt;
	If $i_XCordinate &amp;lt;&amp;gt; -1 And $i_YCordinate &amp;lt;&amp;gt; -1 Then&lt;br /&gt;
		If Abs($i_XCordinate - $a_MousePos[0]) &amp;gt; Abs($i_YCordinate - $a_MousePos[1]) Then&lt;br /&gt;
			MouseMove($a_MousePos[0], $i_YCordinate, 1)&lt;br /&gt;
		ElseIf Abs($i_XCordinate - $a_MousePos[0]) &amp;lt; Abs($i_YCordinate - $a_MousePos[1]) Then&lt;br /&gt;
			MouseMove($i_XCordinate, $a_MousePos[1], 1)&lt;br /&gt;
		Else&lt;br /&gt;
			MouseMove($i_XCordinate, $i_YCordinate, 1)&lt;br /&gt;
		EndIf&lt;br /&gt;
	EndIf&lt;br /&gt;
EndFunc   ;==&amp;gt;_MouseRepel&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _MyMouseMove ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=3602-martin&lt;br /&gt;
|AuthorName=martin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Work with any screen resolution&lt;br /&gt;
; This is for the 1440 x 900 screen - change as needed&lt;br /&gt;
&lt;br /&gt;
Global Const $iHeight = 900&lt;br /&gt;
Global Const $iWidth = 1440&lt;br /&gt;
&lt;br /&gt;
_MyMouseMove(100, 200)&lt;br /&gt;
&lt;br /&gt;
Func _MyMouseMove($iX, $iY)&lt;br /&gt;
	Return MouseMove(@DesktopWidth * $iX / $iWidth, @DesktopHeight * $iY / $iHeight)&lt;br /&gt;
EndFunc   ;==&amp;gt;_MyMouseMove&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Restricted Input Keys - All USB Devices ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorName=Multiple Authors&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $iInput = 99&lt;br /&gt;
&lt;br /&gt;
; Restricted keys in an input &amp;quot;[\/:*?&amp;quot;&amp;lt;&amp;gt;\|]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
	Local Const $hGUI = GUICreate(&amp;quot;Input Filter&amp;quot;, 300, 30, -1, -1)&lt;br /&gt;
&lt;br /&gt;
	$iInput = GUICtrlCreateInput(&#039;&#039;, 5, 5, 290)&lt;br /&gt;
&lt;br /&gt;
	GUIRegisterMsg($WM_COMMAND, &amp;quot;WM_COMMAND&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	GUISetState(@SW_SHOWNORMAL, $hGUI)&lt;br /&gt;
&lt;br /&gt;
	While 1&lt;br /&gt;
		Switch GUIGetMsg()&lt;br /&gt;
			Case $GUI_EVENT_CLOSE&lt;br /&gt;
				ExitLoop&lt;br /&gt;
		EndSwitch&lt;br /&gt;
	WEnd&lt;br /&gt;
&lt;br /&gt;
	GUIDelete($hGUI)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)&lt;br /&gt;
	#forceref $hWnd, $iMsg, $wParam, $lParam&lt;br /&gt;
	Return GUICtrlSetData($iInput, StringRegExpReplace(GUICtrlRead($iInput), &#039;[\\/ :* ?&amp;quot;&amp;lt;&amp;gt;\|]&#039;, &#039;&#039;))&lt;br /&gt;
EndFunc   ;==&amp;gt;WM_COMMAND&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Two Tray Mouse Menus ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=13029-smashly&lt;br /&gt;
|AuthorName=smashly&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Two Tray Menus - Right &amp;amp; Left Click On Icon&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Constants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;TrayOnEventMode&amp;quot;,1)&lt;br /&gt;
Opt(&amp;quot;TrayMenuMode&amp;quot;,1)&lt;br /&gt;
&lt;br /&gt;
TraySetClick(18)&lt;br /&gt;
&lt;br /&gt;
Global $Tray[11], $state = 2&lt;br /&gt;
&lt;br /&gt;
TrayCreateItem(&#039;&#039;)&lt;br /&gt;
TrayCreateItem(&amp;quot;Exit&amp;quot;)&lt;br /&gt;
TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, &amp;quot;TrayMenuLeftClick&amp;quot;)&lt;br /&gt;
TraySetOnEvent($TRAY_EVENT_SECONDARYDOWN, &amp;quot;TrayMenuRightClick&amp;quot;)&lt;br /&gt;
TraySetState()&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func TrayMenuLeftClick()&lt;br /&gt;
    If $state = 0 Or $state = 2 Then&lt;br /&gt;
        $state = 1&lt;br /&gt;
        For $i = 6 to 10&lt;br /&gt;
            TrayItemDelete($Tray[$i])&lt;br /&gt;
        Next&lt;br /&gt;
        For $i = 1 to 5&lt;br /&gt;
            $Tray[$i] = TrayCreateItem(&amp;quot;1st Menu Item - &amp;quot; &amp;amp; $i, -1, $i -1 )&lt;br /&gt;
            TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
        Next&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&lt;br /&gt;
Func TrayMenuRightClick()&lt;br /&gt;
    If $state = 1 Or $state = 2 Then&lt;br /&gt;
        $state = 0&lt;br /&gt;
        For $i = 1 to 5&lt;br /&gt;
            TrayItemDelete($Tray[$i])&lt;br /&gt;
        Next&lt;br /&gt;
        For $i = 6 to 10&lt;br /&gt;
            $Tray[$i] = TrayCreateItem(&amp;quot;2nd Menu Item - &amp;quot; &amp;amp; $i - 5, -1, $i - 6)&lt;br /&gt;
            TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
        Next&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&lt;br /&gt;
Func TrayEvent()&lt;br /&gt;
    MsgBox(0, &#039;&#039;, TrayItemGetText(@TRAY_ID))&lt;br /&gt;
    If TrayItemGetText(@TRAY_ID) = &amp;quot;Exit&amp;quot; Then Exit&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _WinAPI_SwapMouseButton ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
    ; Swap the left button to generate right-button messages and vice versa.&lt;br /&gt;
    ConsoleWrite(_WinAPI_SwapMouseButton(True) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
    ; Wait for the user to see the changes.&lt;br /&gt;
    Sleep(10000)&lt;br /&gt;
&lt;br /&gt;
    ; Change the mouse buttons back to their original meanings.&lt;br /&gt;
    ConsoleWrite(_WinAPI_SwapMouseButton(False) &amp;amp; @CRLF)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
; If $fFlag is True, the left button generates right-button messages and the right button generates left-button messages.&lt;br /&gt;
; If $fFlag is False, the buttons are restored to their original meanings.&lt;br /&gt;
Func _WinAPI_SwapMouseButton($fFlag)&lt;br /&gt;
    Local $aReturn = DllCall(&#039;user32.dll&#039;, &#039;int&#039;, &#039;SwapMouseButton&#039;, &#039;int&#039;, $fFlag)&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(1, 0, 0)&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return $aReturn[0]&lt;br /&gt;
EndFunc   ;==&amp;gt;_WinAPI_SwapMouseButton&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;/div&gt;</summary>
		<author><name>DatMCEyeBall</name></author>
	</entry>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Mouse_%26_Keyboard_)&amp;diff=11914</id>
		<title>Snippets ( AutoIt Mouse &amp; Keyboard )</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Mouse_%26_Keyboard_)&amp;diff=11914"/>
		<updated>2013-08-24T18:59:59Z</updated>

		<summary type="html">&lt;p&gt;DatMCEyeBall: /* Get Mouse Position With Hotkey */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
[[category:Snippets]]&lt;br /&gt;
&lt;br /&gt;
{{Snippet Credit Header}}&lt;br /&gt;
&lt;br /&gt;
== Control Button by HotKey ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=4813-smoke-n&lt;br /&gt;
|AuthorName=SmOke_N&lt;br /&gt;
|Desc=http://www.autoitscript.com/forum/index.php?s=&amp;amp;showtopic=36564&amp;amp;view=findpost&amp;amp;p=270412&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Control Button by HotKey&lt;br /&gt;
; http://www.autoitscript.com/forum/index.php?s=&amp;amp;showtopic=36564&amp;amp;view=findpost&amp;amp;p=270412&lt;br /&gt;
HotKeySet(&amp;quot;+4&amp;quot;, &amp;quot;_ClickButton&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Global Const $Main = GUICreate(&amp;quot;Some GUI&amp;quot;, 200, 100)&lt;br /&gt;
&lt;br /&gt;
Global Const $Button = GUICtrlCreateButton(&amp;quot;Some Button To Click&amp;quot;, 10, 35, 180, 30)&lt;br /&gt;
&lt;br /&gt;
Global $fClickit&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Switch GUIGetMsg()&lt;br /&gt;
        Case - 3&lt;br /&gt;
            Exit&lt;br /&gt;
        Case $Button&lt;br /&gt;
            If Not $fClickit Then&lt;br /&gt;
                MsgBox(64, &amp;quot;Clicked&amp;quot;, &amp;quot;You clicked the button&amp;quot;)&lt;br /&gt;
            Else&lt;br /&gt;
                $fClickit = Not $fClickit&lt;br /&gt;
                MsgBox(64, &amp;quot;Clicked&amp;quot;, &amp;quot;You used a hotkey to click the button&amp;quot;)&lt;br /&gt;
            EndIf&lt;br /&gt;
    EndSwitch&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func _ClickButton()&lt;br /&gt;
    $fClickit = Not $fClickit&lt;br /&gt;
    ControlClick(HWnd($Main), &#039;&#039;, $Button)&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ControlMouseClick ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=58637-fett8802&lt;br /&gt;
|AuthorName=fett8802&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; #FUNCTION# ====================================================================================================================&lt;br /&gt;
; Name...........: _ControlMouseClick&lt;br /&gt;
; Description ...: Use the mouse to move to a control and click it&lt;br /&gt;
; Syntax.........: _ControlMouseClick($iTitle, $iText, $iControl [, $iButton = &amp;quot;left&amp;quot; [, $iClicks = &amp;quot;1&amp;quot; [, $iSpeed = &amp;quot;10&amp;quot; [, $iXpos = &#039;&#039; [, $iYpos = &#039;&#039; ]]]]] )&lt;br /&gt;
; Parameters ....: $iTitle  - The title of the window containing the control&lt;br /&gt;
;      $iText  - Some text from the window containing the control. Can enter no text be using &#039;&#039;&lt;br /&gt;
;      $iControl - The Control ID of the control to click&lt;br /&gt;
;      $iButton  - [optional] The button to click: &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;middle&amp;quot;, &amp;quot;main&amp;quot;, &amp;quot;menu&amp;quot;, &amp;quot;primary&amp;quot;, &amp;quot;secondary&amp;quot;. Default is &amp;quot;left&amp;quot;&lt;br /&gt;
;      $iClicks  - [optional] The number of times to click the mouse. Default is 1.&lt;br /&gt;
;      $iSpeed  - [optional] The speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.&lt;br /&gt;
;      $iXpos  - [optional] The x position to click within the control. Default is center.&lt;br /&gt;
;      $iYpos  - [optional] The y position to click within the control. Default is center.&lt;br /&gt;
; Author ........: Kris Mills &amp;lt;fett8802 at gmail dot com&amp;gt;&lt;br /&gt;
; UserCallTip....: _ControlMouseClick ( &amp;quot;title&amp;quot;, &amp;quot;text&amp;quot;, controlID [, button [, clicks [, speed [, x [, y ]]]]] ) Use the mouse to move to a control and click it.(required: #include &amp;lt;KrisUDF.au3&amp;gt;)&lt;br /&gt;
; ===============================================================================================================================&lt;br /&gt;
Func _ControlMouseClick($iTitle, $iText, $iControl, $iButton = &amp;quot;left&amp;quot;, $iClicks = &amp;quot;1&amp;quot;, $iSpeed = &amp;quot;10&amp;quot;, $iXpos = &#039;&#039;, $iYpos = &#039;&#039;)&lt;br /&gt;
	$iOriginal = Opt(&amp;quot;MouseCoordMode&amp;quot;, 2) ;Change the MouseCoordMode to relative coords and get the previous setting&lt;br /&gt;
	$aPos = ControlGetPos($iTitle, $iText, $iControl) ;Get the position of the given control&lt;br /&gt;
	MouseClick($iButton, $aPos[0] + ($aPos[2] / 2) + $iXpos, $aPos[1] + ($aPos[3] / 2) + $iYpos, $iClicks, $iSpeed) ;Move the mouse and click on the given control&lt;br /&gt;
	Opt(&amp;quot;MouseCoordMode&amp;quot;, $iOriginal) ;Change the MouseCoordMode back to the original&lt;br /&gt;
EndFunc   ;==&amp;gt;_ControlMouseClick&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Get Mouse Position ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=33528-shmuelw1&lt;br /&gt;
|AuthorName=shmuelw1&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; This script returns the current mouse position&lt;br /&gt;
; Edit the value of $mode as required&lt;br /&gt;
#include &amp;lt;Misc.au3&amp;gt; ; required for _IsPressed&lt;br /&gt;
&lt;br /&gt;
Global $mode = 0 ; this sets the MouseCoordMode - see Opt(&amp;quot;MouseCoordMode&amp;quot; later in the script&lt;br /&gt;
Global $modeText&lt;br /&gt;
Global $pos&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;MouseCoordMode&amp;quot;, $mode) ; 1 = absolute screen position, 0 = relative to active windows, 2 = relative to client area&lt;br /&gt;
Opt(&amp;quot;TrayIconDebug&amp;quot;, 1)&lt;br /&gt;
&lt;br /&gt;
Switch $mode&lt;br /&gt;
    Case 0&lt;br /&gt;
        $modeText = &amp;quot;relative to the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
    Case 1&lt;br /&gt;
        $modeText = &amp;quot;from the top-right of the screen is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
    Case 2&lt;br /&gt;
        $modeText = &amp;quot;relative to the client area of the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
EndSwitch&lt;br /&gt;
&lt;br /&gt;
ToolTip(&amp;quot;Move the pointer to the desired location. Press Enter to continue.&amp;quot;, @DesktopWidth/2-250, @DesktopHeight/2-10)&lt;br /&gt;
&lt;br /&gt;
While Not _IsPressed(&amp;quot;0D&amp;quot;) ; wait for Enter key&lt;br /&gt;
    Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
ToolTip(&#039;&#039;) ; close ToolTip&lt;br /&gt;
&lt;br /&gt;
$pos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
MsgBox(0, &amp;quot;Mouse Position&amp;quot;, &amp;quot;The mouse position &amp;quot; &amp;amp; $modeText &amp;amp; $pos[0] &amp;amp; &amp;quot;,&amp;quot; &amp;amp; $pos[1] &amp;amp; &amp;quot; (x,y)&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Get Mouse Position With Hotkey ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=33528-shmuelw1&lt;br /&gt;
|AuthorName=shmuelw1&lt;br /&gt;
|Desc=This script returns the current mouse position&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; 2013/08/24 20:58 PM -&amp;gt; Code tidied by DatMCEyeBall&lt;br /&gt;
&lt;br /&gt;
; This script returns the current mouse position&lt;br /&gt;
; Edit the value of $mode as required&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Misc.au3&amp;gt; ; required for _IsPressed&lt;br /&gt;
&lt;br /&gt;
Global $mode = 0 ; this sets the MouseCoordMode - see Opt(&amp;quot;MouseCoordMode&amp;quot; later in the script&lt;br /&gt;
Global $modeText&lt;br /&gt;
Global $pos&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;MouseCoordMode&amp;quot;, $mode) ;1=absolute screen position, 0=relative to active windows, 2= relative to client area&lt;br /&gt;
Opt(&amp;quot;TrayIconDebug&amp;quot;, 1)&lt;br /&gt;
&lt;br /&gt;
HotKeySet(&amp;quot;^#s&amp;quot;, &amp;quot;_GetPosition&amp;quot;) ; ! = ALT keystroke, + = SHIFT, ^ = CONTROL, # = Windows key&lt;br /&gt;
&lt;br /&gt;
Switch $mode&lt;br /&gt;
	Case 0&lt;br /&gt;
		$modeText = &amp;quot;relative to the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
	Case 1&lt;br /&gt;
		$modeText = &amp;quot;from the top-right of the screen is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
	Case 2&lt;br /&gt;
		$modeText = &amp;quot;relative to the client area of the active window is:&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
EndSwitch&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
	Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func _GetPosition()&lt;br /&gt;
	ToolTip(&amp;quot;Move the pointer to the desired location. Press Enter to continue.&amp;quot;, @DesktopWidth / 2 - 250, @DesktopHeight / 2 - 10)&lt;br /&gt;
&lt;br /&gt;
	While Not _IsPressed(&amp;quot;0D&amp;quot;) ; wait for Enter key&lt;br /&gt;
		Sleep(100)&lt;br /&gt;
	WEnd&lt;br /&gt;
&lt;br /&gt;
	ToolTip(&#039;&#039;) ; close ToolTip&lt;br /&gt;
&lt;br /&gt;
	$pos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
	MsgBox(0, &amp;quot;Mouse Position&amp;quot;, &amp;quot;The mouse position &amp;quot; &amp;amp; $modeText &amp;amp; $pos[0] &amp;amp; &amp;quot;,&amp;quot; &amp;amp; $pos[1] &amp;amp; &amp;quot; (x,y)&amp;quot;)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetPosition&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsLeftHandedMouse ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite( _IsLeftHandedMouse() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _IsLeftHandedMouse()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_SWAPBUTTON) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsLeftHandedMouse&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsRightHandedMouse ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MsgBox(64, &amp;quot;_IsRightHandedMouse()&amp;quot;, _IsRightHandedMouse())&lt;br /&gt;
&lt;br /&gt;
Func _IsRightHandedMouse()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_SWAPBUTTON) = 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsRightHandedMouse&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Is Mouse Over GUI ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=20477-mrcreator&lt;br /&gt;
|AuthorName=MrCreatoR&lt;br /&gt;
|ModifierURL=4920-valuater&lt;br /&gt;
|ModifierName=Valuater&lt;br /&gt;
|Desc=Check if Mouse is over a GUI&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check if Mouse is over a GUI&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;GUIConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $ParentWin = GUICreate(&amp;quot;GetHoveredHwnd&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    If GUIGetMsg() = -3 Then Exit&lt;br /&gt;
&lt;br /&gt;
    If GetHoveredHwnd() = $ParentWin Then&lt;br /&gt;
        ToolTip(&amp;quot;You are over the GUI&amp;quot;)&lt;br /&gt;
    Else&lt;br /&gt;
        ToolTip(&#039;&#039;)&lt;br /&gt;
    EndIf&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func GetHoveredHwnd()&lt;br /&gt;
    Local $iRet = DllCall(&amp;quot;user32.dll&amp;quot;, &amp;quot;int&amp;quot;, &amp;quot;WindowFromPoint&amp;quot;, &amp;quot;long&amp;quot;, MouseGetPos(0), &amp;quot;long&amp;quot;, MouseGetPos(1))&lt;br /&gt;
    If IsArray($iRet) Then Return HWnd($iRet[0])&lt;br /&gt;
    Return SetError(1, 0, 0)&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsMouseInstalled ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MsgBox(64, &amp;quot;_IsMouseInstalled()&amp;quot;, _IsMouseInstalled())&lt;br /&gt;
&lt;br /&gt;
Func _IsMouseInstalled()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_CMOUSEBUTTONS) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsMouseInstalled&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsMouseWheelPresent ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_IsMouseWheelPresent() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _IsMouseWheelPresent()&lt;br /&gt;
    Return _WinAPI_GetSystemMetrics($SM_MOUSEWHEELPRESENT) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsMouseWheelPresent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _MouseRepel ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=6946-the-kandie-man&lt;br /&gt;
|AuthorName=The Kandie Man&lt;br /&gt;
|Desc=Mouse repel - keep mouse away from an area&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; GUI snap to corners&lt;br /&gt;
; Mouse repel - keep mouse away from an area&lt;br /&gt;
; Author - The Kandie Man&lt;br /&gt;
&lt;br /&gt;
Global Const $GUI = GUICreate(&amp;quot;Can&#039;t Touch This&amp;quot;, 200, 100, 200, 200)&lt;br /&gt;
&lt;br /&gt;
GUISetState(@SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
AdlibRegister(&amp;quot;CallMouseRepel&amp;quot;, 10)&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Sleep(1000)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func CallMouseRepel()&lt;br /&gt;
    Local Const $coords = WinGetPos($GUI)&lt;br /&gt;
    _MouseRepel($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3])&lt;br /&gt;
EndFunc   ;==&amp;gt;CallMouseRepel&lt;br /&gt;
&lt;br /&gt;
;===============================================================================&lt;br /&gt;
; Description:    _MouseRepel&lt;br /&gt;
; Parameter(s):   $i_left - Left coord&lt;br /&gt;
;                 $i_top - Top coord&lt;br /&gt;
;                 $i_right - Right coord&lt;br /&gt;
;                 $i_bottom - Bottom coord&lt;br /&gt;
; User CallTip:   _MouseRepel([$i_left = 0[, $i_top = 0[, $i_right = 0[, $i_bottom = 0]]]]) Repel the Mouse Cursor to specified coords.&lt;br /&gt;
; Author(s):      The Kandie Man&lt;br /&gt;
; Note(s):        This function must be called constantly to prevent the mouse cursor from entering the area.&lt;br /&gt;
;                 It is therefore recommended that you call this function from another function that is called by AdlibEnable every 1 to 50ms.&lt;br /&gt;
;===============================================================================&lt;br /&gt;
Func _MouseRepel($i_left = 0, $i_top = 0, $i_right = 0, $i_bottom = 0)&lt;br /&gt;
    Local $a_MousePos = MouseGetPos()&lt;br /&gt;
&lt;br /&gt;
    Local $i_XCordinate = -1, $i_YCordinate = -1&lt;br /&gt;
&lt;br /&gt;
    If $a_MousePos[0] &amp;gt;= $i_left And $a_MousePos[0] &amp;lt;= $i_right Then&lt;br /&gt;
        If ($a_MousePos[0] - $i_left) &amp;lt; ($i_right - $a_MousePos[0]) Then&lt;br /&gt;
            $i_XCordinate = $i_left - 1&lt;br /&gt;
        Else&lt;br /&gt;
            $i_XCordinate = $i_right + 1&lt;br /&gt;
        EndIf&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    If $a_MousePos[1] &amp;gt;= $i_top And $a_MousePos[1] &amp;lt;= $i_bottom Then&lt;br /&gt;
        If ($a_MousePos[1] - $i_top) &amp;lt; ($i_bottom - $a_MousePos[1]) Then&lt;br /&gt;
            $i_YCordinate = $i_top - 1&lt;br /&gt;
        Else&lt;br /&gt;
            $i_YCordinate = $i_bottom + 1&lt;br /&gt;
        EndIf&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    If $i_XCordinate &amp;lt;&amp;gt; -1 And $i_YCordinate &amp;lt;&amp;gt; -1 Then&lt;br /&gt;
        If Abs($i_XCordinate - $a_MousePos[0]) &amp;gt; Abs($i_YCordinate - $a_MousePos[1]) Then&lt;br /&gt;
            MouseMove($a_MousePos[0], $i_YCordinate, 1)&lt;br /&gt;
        ElseIf Abs($i_XCordinate - $a_MousePos[0]) &amp;lt; Abs($i_YCordinate - $a_MousePos[1]) Then&lt;br /&gt;
            MouseMove($i_XCordinate, $a_MousePos[1], 1)&lt;br /&gt;
        Else&lt;br /&gt;
            MouseMove($i_XCordinate, $i_YCordinate, 1)&lt;br /&gt;
        EndIf&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc   ;==&amp;gt;_MouseRepel&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _MyMouseMove ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=3602-martin&lt;br /&gt;
|AuthorName=martin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Work with any screen resolution&lt;br /&gt;
; This is for the 1440 x 900 screen - change as needed&lt;br /&gt;
&lt;br /&gt;
Global Const $iHeight = 900&lt;br /&gt;
Global Const $iWidth = 1440&lt;br /&gt;
&lt;br /&gt;
_MyMouseMove(100, 200)&lt;br /&gt;
&lt;br /&gt;
Func _MyMouseMove($iX, $iY)&lt;br /&gt;
	Return MouseMove(@DesktopWidth * $iX / $iWidth, @DesktopHeight * $iY / $iHeight)&lt;br /&gt;
EndFunc   ;==&amp;gt;_MyMouseMove&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Restricted Input Keys - All USB Devices ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorName=Multiple Authors&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $iInput = 99&lt;br /&gt;
&lt;br /&gt;
; Restricted keys in an input &amp;quot;[\/:*?&amp;quot;&amp;lt;&amp;gt;\|]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
	Local Const $hGUI = GUICreate(&amp;quot;Input Filter&amp;quot;, 300, 30, -1, -1)&lt;br /&gt;
&lt;br /&gt;
	$iInput = GUICtrlCreateInput(&#039;&#039;, 5, 5, 290)&lt;br /&gt;
&lt;br /&gt;
	GUIRegisterMsg($WM_COMMAND, &amp;quot;WM_COMMAND&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	GUISetState(@SW_SHOWNORMAL, $hGUI)&lt;br /&gt;
&lt;br /&gt;
	While 1&lt;br /&gt;
		Switch GUIGetMsg()&lt;br /&gt;
			Case $GUI_EVENT_CLOSE&lt;br /&gt;
				ExitLoop&lt;br /&gt;
		EndSwitch&lt;br /&gt;
	WEnd&lt;br /&gt;
&lt;br /&gt;
	GUIDelete($hGUI)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)&lt;br /&gt;
	#forceref $hWnd, $iMsg, $wParam, $lParam&lt;br /&gt;
	Return GUICtrlSetData($iInput, StringRegExpReplace(GUICtrlRead($iInput), &#039;[\\/ :* ?&amp;quot;&amp;lt;&amp;gt;\|]&#039;, &#039;&#039;))&lt;br /&gt;
EndFunc   ;==&amp;gt;WM_COMMAND&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Two Tray Mouse Menus ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=13029-smashly&lt;br /&gt;
|AuthorName=smashly&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Two Tray Menus - Right &amp;amp; Left Click On Icon&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Constants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Opt(&amp;quot;TrayOnEventMode&amp;quot;,1)&lt;br /&gt;
Opt(&amp;quot;TrayMenuMode&amp;quot;,1)&lt;br /&gt;
&lt;br /&gt;
TraySetClick(18)&lt;br /&gt;
&lt;br /&gt;
Global $Tray[11], $state = 2&lt;br /&gt;
&lt;br /&gt;
TrayCreateItem(&#039;&#039;)&lt;br /&gt;
TrayCreateItem(&amp;quot;Exit&amp;quot;)&lt;br /&gt;
TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, &amp;quot;TrayMenuLeftClick&amp;quot;)&lt;br /&gt;
TraySetOnEvent($TRAY_EVENT_SECONDARYDOWN, &amp;quot;TrayMenuRightClick&amp;quot;)&lt;br /&gt;
TraySetState()&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Sleep(100)&lt;br /&gt;
WEnd&lt;br /&gt;
&lt;br /&gt;
Func TrayMenuLeftClick()&lt;br /&gt;
    If $state = 0 Or $state = 2 Then&lt;br /&gt;
        $state = 1&lt;br /&gt;
        For $i = 6 to 10&lt;br /&gt;
            TrayItemDelete($Tray[$i])&lt;br /&gt;
        Next&lt;br /&gt;
        For $i = 1 to 5&lt;br /&gt;
            $Tray[$i] = TrayCreateItem(&amp;quot;1st Menu Item - &amp;quot; &amp;amp; $i, -1, $i -1 )&lt;br /&gt;
            TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
        Next&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&lt;br /&gt;
Func TrayMenuRightClick()&lt;br /&gt;
    If $state = 1 Or $state = 2 Then&lt;br /&gt;
        $state = 0&lt;br /&gt;
        For $i = 1 to 5&lt;br /&gt;
            TrayItemDelete($Tray[$i])&lt;br /&gt;
        Next&lt;br /&gt;
        For $i = 6 to 10&lt;br /&gt;
            $Tray[$i] = TrayCreateItem(&amp;quot;2nd Menu Item - &amp;quot; &amp;amp; $i - 5, -1, $i - 6)&lt;br /&gt;
            TrayItemSetOnEvent(-1, &amp;quot;TrayEvent&amp;quot;)&lt;br /&gt;
        Next&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&lt;br /&gt;
Func TrayEvent()&lt;br /&gt;
    MsgBox(0, &#039;&#039;, TrayItemGetText(@TRAY_ID))&lt;br /&gt;
    If TrayItemGetText(@TRAY_ID) = &amp;quot;Exit&amp;quot; Then Exit&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _WinAPI_SwapMouseButton ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
    ; Swap the left button to generate right-button messages and vice versa.&lt;br /&gt;
    ConsoleWrite(_WinAPI_SwapMouseButton(True) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
    ; Wait for the user to see the changes.&lt;br /&gt;
    Sleep(10000)&lt;br /&gt;
&lt;br /&gt;
    ; Change the mouse buttons back to their original meanings.&lt;br /&gt;
    ConsoleWrite(_WinAPI_SwapMouseButton(False) &amp;amp; @CRLF)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
; If $fFlag is True, the left button generates right-button messages and the right button generates left-button messages.&lt;br /&gt;
; If $fFlag is False, the buttons are restored to their original meanings.&lt;br /&gt;
Func _WinAPI_SwapMouseButton($fFlag)&lt;br /&gt;
    Local $aReturn = DllCall(&#039;user32.dll&#039;, &#039;int&#039;, &#039;SwapMouseButton&#039;, &#039;int&#039;, $fFlag)&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(1, 0, 0)&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return $aReturn[0]&lt;br /&gt;
EndFunc   ;==&amp;gt;_WinAPI_SwapMouseButton&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;/div&gt;</summary>
		<author><name>DatMCEyeBall</name></author>
	</entry>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Array_)&amp;diff=11913</id>
		<title>Snippets ( AutoIt Array )</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=Snippets_(_AutoIt_Array_)&amp;diff=11913"/>
		<updated>2013-08-24T18:52:39Z</updated>

		<summary type="html">&lt;p&gt;DatMCEyeBall: /* _ArrayEmpty */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
[[category:Snippets]]&lt;br /&gt;
&lt;br /&gt;
{{Snippet Credit Header}}&lt;br /&gt;
&lt;br /&gt;
== _1Dto2DArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $aArray_1D[2] = [&amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;]&lt;br /&gt;
_ArrayDisplay($aArray_1D)&lt;br /&gt;
_1Dto2DArray($aArray_1D)&lt;br /&gt;
_ArrayDisplay($aArray_1D)&lt;br /&gt;
&lt;br /&gt;
Global $aArray_1D[10] = [&amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;, &amp;quot;Data&amp;quot;]&lt;br /&gt;
_ArrayDisplay($aArray_1D)&lt;br /&gt;
_1Dto2DArray($aArray_1D, 9)&lt;br /&gt;
_ArrayDisplay($aArray_1D)&lt;br /&gt;
&lt;br /&gt;
Func _1Dto2DArray(ByRef $aArray, Const $iAdditionalColumns = 1)&lt;br /&gt;
    Local Const $iSize = UBound($aArray, 1)&lt;br /&gt;
&lt;br /&gt;
    Local $aReturn[$iSize][$iAdditionalColumns + 1]&lt;br /&gt;
&lt;br /&gt;
    For $A = 0 To $iSize - 1&lt;br /&gt;
        $aReturn[$A][0] = $aArray[$A]&lt;br /&gt;
    Next&lt;br /&gt;
&lt;br /&gt;
    $aArray = $aReturn&lt;br /&gt;
&lt;br /&gt;
    Return $aReturn&lt;br /&gt;
EndFunc   ;==&amp;gt;_1Dto2DArray&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArrayAddEx ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example_1()&lt;br /&gt;
Example_2()&lt;br /&gt;
&lt;br /&gt;
Func Example_1()&lt;br /&gt;
    Local $aArray_1[1] = [&amp;quot;Data_0&amp;quot;], $iBegin&lt;br /&gt;
&lt;br /&gt;
    $iBegin = TimerInit() ; Start the timer.&lt;br /&gt;
    For $i = 1 To 5000&lt;br /&gt;
        _ArrayAdd($aArray_1, &amp;quot;Data_&amp;quot; &amp;amp; $i)&lt;br /&gt;
    Next&lt;br /&gt;
    $iBegin = TimerDiff($iBegin) ; End the timer and find the difference from start to finish.&lt;br /&gt;
    ConsoleWrite(&amp;quot;_ArrayAdd from Array.au3 &amp;gt;&amp;gt; &amp;quot; &amp;amp; $iBegin &amp;amp; @CRLF)&lt;br /&gt;
    _ArrayDisplay($aArray_1)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example_1&lt;br /&gt;
&lt;br /&gt;
Func Example_2()&lt;br /&gt;
    Local $aArray_2[1] = [&amp;quot;Data_0&amp;quot;], $iBegin, $iDimension, $iCount&lt;br /&gt;
&lt;br /&gt;
    $iBegin = TimerInit() ; Start the timer.&lt;br /&gt;
    For $i = 1 To 5000&lt;br /&gt;
        _ArrayAddEx($aArray_2, &amp;quot;Data_&amp;quot; &amp;amp; $i, $iDimension, $iCount) ; $iDimension is the overall size of the array &amp;amp; $iCount is the last index number, because regarding the overall size +1 as the next item will give false results as we&#039;re increasing the size of the array not by 1 but multiplying 2.&lt;br /&gt;
    Next&lt;br /&gt;
    $iBegin = TimerDiff($iBegin) ; End the timer and find the difference from start to finish.&lt;br /&gt;
    ConsoleWrite(&amp;quot;_ArrayAddEx by guinness &amp;gt;&amp;gt; &amp;quot; &amp;amp; $iBegin &amp;amp; @CRLF)&lt;br /&gt;
    ReDim $aArray_2[$iCount] ; Remove the empty rows.&lt;br /&gt;
    _ArrayDisplay($aArray_2)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example_2&lt;br /&gt;
&lt;br /&gt;
Func _ArrayAddEx(ByRef $aArray, $sData, ByRef $iDimension, ByRef $iCount) ; Taken from Array.au3 and modified by guinness to reduce the use of ReDim.&lt;br /&gt;
    If IsArray($aArray) = 0 Then&lt;br /&gt;
        Return SetError(1, 0, -1)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    If UBound($aArray, 0) &amp;lt;&amp;gt; 1 Then&lt;br /&gt;
        Return SetError(2, 0, -1)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    If $iCount = 0 Then&lt;br /&gt;
        $iCount = UBound($aArray, 1)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    $iCount += 1&lt;br /&gt;
    If ($iCount + 1) &amp;gt;= $iDimension Then&lt;br /&gt;
        $iDimension = (UBound($aArray, 1) + 1) * 2&lt;br /&gt;
        ReDim $aArray[$iDimension]&lt;br /&gt;
    EndIf&lt;br /&gt;
    $aArray[$iCount - 1] = $sData&lt;br /&gt;
    Return $iCount - 1&lt;br /&gt;
EndFunc   ;==&amp;gt;_ArrayAddEx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArrayEmpty ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
|Desc=Creates Empty 1D &amp;amp; 2D Array&#039;s&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $aMain[11] = [10]&lt;br /&gt;
_ArrayEmpty($aMain)&lt;br /&gt;
_ArrayDisplay($aMain, &amp;quot;Empty 1D Array.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Global $aMainEx[11][3] = [[10]]&lt;br /&gt;
_ArrayEmpty($aMainEx)&lt;br /&gt;
_ArrayDisplay($aMainEx, &amp;quot;Empty 2D Array.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Func _ArrayEmpty(ByRef $aArray)&lt;br /&gt;
    Switch UBound($aArray, 0) ; Dimension, 1D or 2D array are supported.&lt;br /&gt;
        Case 1&lt;br /&gt;
            Local $aEmpty1D[1]&lt;br /&gt;
            $aArray = $aEmpty1D&lt;br /&gt;
&lt;br /&gt;
        Case 2&lt;br /&gt;
            ; Edit by DatMCEyeBall - Instead of emptying the array to [1][$x] we empty it to [$x][$y]&lt;br /&gt;
            ; where $x is the 1st dimensions size and $y the 2nd.&lt;br /&gt;
            ; Previous code was: Local $aEmpty2D[1][UBound($aArray, 2)]&lt;br /&gt;
            Local $aEmpty2D[UBound($aArray, 1)][UBound($aArray, 2)]&lt;br /&gt;
            $aArray = $aEmpty2D&lt;br /&gt;
    EndSwitch&lt;br /&gt;
EndFunc   ;==&amp;gt;_ArrayEmpty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArrayGet ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=31965-progandy&lt;br /&gt;
|AuthorName=ProgAndy&lt;br /&gt;
|Desc=Easy access for nested arrays up to 20 nested dimensions (including multidimensional arrays)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Global $b[2] = [&amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;]&lt;br /&gt;
Global $a[3][2] = [[0, -1], [$b, &amp;quot;x&amp;quot;], [1, -2]]&lt;br /&gt;
&lt;br /&gt;
Global $c[5] = [11, 22, 33, 44, 55]&lt;br /&gt;
&lt;br /&gt;
MsgBox(0, &amp;quot;&amp;quot;, _ArrayGet($a, 1, 0, 1) &amp;amp; &amp;quot; # &amp;quot; &amp;amp; @error)&lt;br /&gt;
&lt;br /&gt;
; #FUNCTION# ====================================================================================================================&lt;br /&gt;
; Name ..........: _ArrayGet&lt;br /&gt;
; Description ...: Gets a value from a nested multidimensional array&lt;br /&gt;
; Syntax ........: _ArrayGet(Byref $aArray, $i1[, $i2 = 0[, $i3 = 0[, $i4 = 0[, $i5 = 0[, $i6 = 0[, $i7 = 0[, $i8 = 0[,&lt;br /&gt;
;                 $i9 = 0[, $i10 = 0[, $i11 = 0[, $i12 = 0[, $i13 = 0[, $i14 = 0[, $i15 = 0[, $i16 = 0[, $i17 = 0[,&lt;br /&gt;
;                 $i18 = 0[, $i19 = 0[, $i20 = 0]]]]]]]]]]]]]]]]]]])&lt;br /&gt;
; Parameters ....: $aArray            - [in/out] An array of unknowns.&lt;br /&gt;
;                 $i1                 - first array index.&lt;br /&gt;
;                 $i2                 - [optional] second array index.&lt;br /&gt;
;                 $i3                 - [optional] third array index.&lt;br /&gt;
;                 $i4                 - [optional] fourth array index.&lt;br /&gt;
;                 $i5                 - [optional] fifth array index.&lt;br /&gt;
;                 $i6                 - [optional] sixth array index.&lt;br /&gt;
;                 $i7                 - [optional] seventh array index.&lt;br /&gt;
;                 $i8                 - [optional] eighth array index.&lt;br /&gt;
;                 $i9                 - [optional] ninth array index.&lt;br /&gt;
;                 $i10               - [optional] 10th array index.&lt;br /&gt;
;                 $i11               - [optional] 11th array index.&lt;br /&gt;
;                 $i12               - [optional] 12th array index.&lt;br /&gt;
;                 $i13               - [optional] 13th array index.&lt;br /&gt;
;                 $i14               - [optional] 14th array index.&lt;br /&gt;
;                 $i15               - [optional] 15th array index.&lt;br /&gt;
;                 $i16               - [optional] 16th array index.&lt;br /&gt;
;                 $i17               - [optional] 17th array index.&lt;br /&gt;
;                 $i18               - [optional] 18th array index.&lt;br /&gt;
;                 $i19               - [optional] 19th array index.&lt;br /&gt;
;                 $i20               - [optional] 20th array index.&lt;br /&gt;
; Return values .: Success: Value at the specified index&lt;br /&gt;
;                 Error: Nothing, Sets @error to:&lt;br /&gt;
;                 |1 - Trying to acces non-array as array&lt;br /&gt;
;                 |2 - Not enough dimensions for the last accessed array&lt;br /&gt;
;                 |3 - Index out of bounds for a dimension&lt;br /&gt;
;                 @extended contains the dimension in error (according to parameter list)&lt;br /&gt;
; Author ........: ProgAndy&lt;br /&gt;
; Modified ......:&lt;br /&gt;
; Remarks .......:&lt;br /&gt;
; Related .......:&lt;br /&gt;
; Link ..........:&lt;br /&gt;
; Example .......: No&lt;br /&gt;
; ===============================================================================================================================&lt;br /&gt;
Func _ArrayGet(ByRef $aArray, $i1, $i2=0, $i3=0, $i4=0, $i5=0, $i6=0, $i7=0, $i8=0, $i9=0, $i10=0, $i11=0, $i12=0, $i13=0, $i14=0, $i15=0, $i16=0, $i17=0, $i18=0, $i19=0, $i20=0)&lt;br /&gt;
	#forceref $i1, $i2, $i3, $i4, $i5, $i6, $i7, $i8, $i9, $i10, $i11, $i12, $i13, $i14, $i15, $i16, $i17, $i18, $i19, $i20&lt;br /&gt;
   ; ProgAndy&lt;br /&gt;
    Local $NULL&lt;br /&gt;
    If Not IsArray($aArray) Then Return SetError(1, 1, $NULL)&lt;br /&gt;
    Local $iDims = UBound($aArray, 0)&lt;br /&gt;
    If @NumParams &amp;lt;= $iDims Then Return SetError(2, @NumParams, $NULL)&lt;br /&gt;
    Local $sAccess = &amp;quot;$aArray&amp;quot;&lt;br /&gt;
    For $i = 1 To $iDims&lt;br /&gt;
        Local $iIndex = Int(Eval(&amp;quot;i&amp;quot; &amp;amp; $i))&lt;br /&gt;
        If $iIndex &amp;gt;= UBound($aArray, $i) Then Return SetError(3, $i, $NULL)&lt;br /&gt;
        $sAccess &amp;amp;= &#039;[&#039; &amp;amp; $iIndex &amp;amp; &#039;]&#039;&lt;br /&gt;
    Next&lt;br /&gt;
    If @NumParams-1 &amp;gt; $iDims Then ; Still indices left&lt;br /&gt;
        For $i = $iDims+1 To @NumParams-1&lt;br /&gt;
            $sAccess &amp;amp;= &amp;quot;, $i&amp;quot; &amp;amp; $i&lt;br /&gt;
        Next&lt;br /&gt;
        Local $vResult = Execute(&amp;quot;_ArrayGet(&amp;quot; &amp;amp; $sAccess &amp;amp; &amp;quot;)&amp;quot;)&lt;br /&gt;
        If @error Then SetError(@error, @extended+$iDims)&lt;br /&gt;
        Return $vResult&lt;br /&gt;
    Else ;&lt;br /&gt;
        Return Execute($sAccess)&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArraySet ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=31965-progandy&lt;br /&gt;
|AuthorName=ProgAndy&lt;br /&gt;
|Desc=Easy access for nested arrays up to 20 nested dimensions (including multidimensional arrays)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Global $b[2] = [&#039;a&#039;, &#039;b&#039;&lt;br /&gt;
Global $a[3][2] = [[0, -1], [$b, &amp;quot;x&amp;quot;], [1, -2]]&lt;br /&gt;
&lt;br /&gt;
Global $c[5] = [11, 22, 33, 44, 55]&lt;br /&gt;
&lt;br /&gt;
_ArraySet($a, $c, 1, 0, 0)&lt;br /&gt;
&lt;br /&gt;
; #FUNCTION# ====================================================================================================================&lt;br /&gt;
; Name ..........: _ArraySet&lt;br /&gt;
; Description ...: Sets a value from a nested multidimensional array&lt;br /&gt;
; Syntax ........: _ArraySet(Byref $aArray, $vValue, $i1[, $i2 = 0[, $i3 = 0[, $i4 = 0[, $i5 = 0[, $i6 = 0[, $i7 = 0[, $i8 = 0[,&lt;br /&gt;
;                 $i9 = 0[, $i10 = 0[, $i11 = 0[, $i12 = 0[, $i13 = 0[, $i14 = 0[, $i15 = 0[, $i16 = 0[, $i17 = 0[,&lt;br /&gt;
;                 $i18 = 0[, $i19 = 0[, $i20 = 0]]]]]]]]]]]]]]]]]]])&lt;br /&gt;
; Parameters ....: $aArray            - [in/out] An array of unknowns.&lt;br /&gt;
;                 $vValue             - value to set at specified index.&lt;br /&gt;
;                 $i1                 - first array index.&lt;br /&gt;
;                 $i2                 - [optional] second array index.&lt;br /&gt;
;                 $i3                 - [optional] third array index.&lt;br /&gt;
;                 $i4                 - [optional] fourth array index.&lt;br /&gt;
;                 $i5                 - [optional] fifth array index.&lt;br /&gt;
;                 $i6                 - [optional] sixth array index.&lt;br /&gt;
;                 $i7                 - [optional] seventh array index.&lt;br /&gt;
;                 $i8                 - [optional] eighth array index.&lt;br /&gt;
;                 $i9                 - [optional] ninth array index.&lt;br /&gt;
;                 $i10               - [optional] 10th array index.&lt;br /&gt;
;                 $i11               - [optional] 11th array index.&lt;br /&gt;
;                 $i12               - [optional] 12th array index.&lt;br /&gt;
;                 $i13               - [optional] 13th array index.&lt;br /&gt;
;                 $i14               - [optional] 14th array index.&lt;br /&gt;
;                 $i15               - [optional] 15th array index.&lt;br /&gt;
;                 $i16               - [optional] 16th array index.&lt;br /&gt;
;                 $i17               - [optional] 17th array index.&lt;br /&gt;
;                 $i18               - [optional] 18th array index.&lt;br /&gt;
;                 $i19               - [optional] 19th array index.&lt;br /&gt;
;                 $i20               - [optional] 20th array index.&lt;br /&gt;
; Return values .: Success: True&lt;br /&gt;
;                 Error: False, Sets @error to:&lt;br /&gt;
;                 |1 - Trying to acces non-array as array&lt;br /&gt;
;                 |2 - Not enough dimensions for the last accessed array&lt;br /&gt;
;                 |3 - Index out of bounds for a dimension&lt;br /&gt;
;                 |all: - @extended contains the dimension in error (according to parameter list)&lt;br /&gt;
; Author ........: ProgAndy&lt;br /&gt;
; Modified ......:&lt;br /&gt;
; Remarks .......:&lt;br /&gt;
; Related .......:&lt;br /&gt;
; Link ..........:&lt;br /&gt;
; Example .......: No&lt;br /&gt;
; ===============================================================================================================================&lt;br /&gt;
Func _ArraySet(ByRef $aArray, Const $vValue, $i1, $i2=0, $i3=0, $i4=0, $i5=0, $i6=0, $i7=0, $i8=0, $i9=0, $i10=0, $i11=0, $i12=0, $i13=0, $i14=0, $i15=0, $i16=0, $i17=0, $i18=0, $i19=0, $i20=0)&lt;br /&gt;
    ; ProgAndy&lt;br /&gt;
    Local Const $NULL = False&lt;br /&gt;
&lt;br /&gt;
    If Not IsArray($aArray) Then Return SetError(1, 1, $NULL)&lt;br /&gt;
&lt;br /&gt;
    Local $iDims = UBound($aArray, 0)&lt;br /&gt;
&lt;br /&gt;
    If @NumParams-2 &amp;lt; $iDims Then Return SetError(2, @NumParams-1, $NULL)&lt;br /&gt;
&lt;br /&gt;
    Local $sAccess = &amp;quot;$aArray&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    For $i = 1 To $iDims&lt;br /&gt;
        Local $iIndex = Int(Eval(&amp;quot;i&amp;quot; &amp;amp; $i))&lt;br /&gt;
        If $iIndex &amp;gt;= UBound($aArray, $i) Then Return SetError(3, $i, $NULL)&lt;br /&gt;
        $sAccess &amp;amp;= &#039;[&#039; &amp;amp; $iIndex &amp;amp; &#039;]&#039;&lt;br /&gt;
    Next&lt;br /&gt;
&lt;br /&gt;
    If @NumParams-2 &amp;gt; $iDims Then&lt;br /&gt;
        $sAccess &amp;amp;= &amp;quot;, $vValue&amp;quot;&lt;br /&gt;
        For $i = $iDims+1 To @NumParams-2&lt;br /&gt;
            $sAccess &amp;amp;= &amp;quot;, $i&amp;quot; &amp;amp; $i&lt;br /&gt;
        Next&lt;br /&gt;
        Local $fSuccess = Execute(&amp;quot;_ArraySet(&amp;quot; &amp;amp; $sAccess &amp;amp; &amp;quot;)&amp;quot;)&lt;br /&gt;
        If @error Then SetError(@error, @extended+$iDims)&lt;br /&gt;
        Return $fSuccess&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    Switch $iDims&lt;br /&gt;
        Case 1&lt;br /&gt;
            $aArray[$i1] = $vValue&lt;br /&gt;
        Case 2&lt;br /&gt;
            $aArray[$i1][$i2] = $vValue&lt;br /&gt;
        Case 3&lt;br /&gt;
            $aArray[$i1][$i2][$i3] = $vValue&lt;br /&gt;
        Case 4&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4] = $vValue&lt;br /&gt;
        Case 5&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5] = $vValue&lt;br /&gt;
        Case 6&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6] = $vValue&lt;br /&gt;
        Case 7&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7] = $vValue&lt;br /&gt;
        Case 8&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8] = $vValue&lt;br /&gt;
        Case 9&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9] = $vValue&lt;br /&gt;
        Case 10&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10] = $vValue&lt;br /&gt;
        Case 11&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11] = $vValue&lt;br /&gt;
        Case 12&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12] = $vValue&lt;br /&gt;
        Case 13&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13] = $vValue&lt;br /&gt;
        Case 14&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14] = $vValue&lt;br /&gt;
        Case 15&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15] = $vValue&lt;br /&gt;
        Case 16&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16] = $vValue&lt;br /&gt;
        Case 17&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16][$i17] = $vValue&lt;br /&gt;
        Case 18&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16][$i17][$i18] = $vValue&lt;br /&gt;
        Case 19&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16][$i17][$i18][$i19] = $vValue&lt;br /&gt;
        Case 20&lt;br /&gt;
            $aArray[$i1][$i2][$i3][$i4][$i5][$i6][$i7][$i8][$i9][$i10][$i11][$i12][$i13][$i14][$i15][$i16][$i17][$i18][$i19][$i20] = $vValue&lt;br /&gt;
	EndSwitch&lt;br /&gt;
&lt;br /&gt;
    Return True&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArrayLength ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Global $aArray[2][50]&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 2) &amp;amp; @CRLF) ;= &amp;gt; 10 - Total items&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 1) &amp;amp; @CRLF) ;= &amp;gt; 5 - Columns&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 0) &amp;amp; @CRLF) ;= &amp;gt; 2 - Rows&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(@CRLF)&lt;br /&gt;
&lt;br /&gt;
Global $aArray[2]&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 2) &amp;amp; @CRLF) ;= &amp;gt; 2 - Total items&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 1) &amp;amp; @CRLF) ;= &amp;gt; 1 - Columns&lt;br /&gt;
ConsoleWrite(_ArrayLength($aArray, 0) &amp;amp; @CRLF) ;= &amp;gt; 2 - Rows&lt;br /&gt;
&lt;br /&gt;
Func _ArrayLength($aArray, $iType = 1)&lt;br /&gt;
    Local $iDim = UBound($aArray, 0)&lt;br /&gt;
&lt;br /&gt;
    If $iDim &amp;lt; 0 Or $iDim &amp;gt; 2 Then ; If not a 1D or 2D Array, then return -1 and set @error to non-zero.&lt;br /&gt;
        Return SetError(1, 0, -1)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    Switch $iType&lt;br /&gt;
        Case 2&lt;br /&gt;
            If $iDim = 2 Then&lt;br /&gt;
                Return UBound($aArray, 2) * UBound($aArray, 1)&lt;br /&gt;
            Else&lt;br /&gt;
                Return UBound($aArray, 1)&lt;br /&gt;
            EndIf&lt;br /&gt;
&lt;br /&gt;
        Case 1&lt;br /&gt;
            If $iDim = 2 Then&lt;br /&gt;
                Return UBound($aArray, 2)&lt;br /&gt;
            Else&lt;br /&gt;
                Return 1&lt;br /&gt;
            EndIf&lt;br /&gt;
&lt;br /&gt;
        Case Else&lt;br /&gt;
            Return UBound($aArray, 1)&lt;br /&gt;
    EndSwitch&lt;br /&gt;
EndFunc   ;==&amp;gt;_ArrayLength&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _ArraySortNum ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=4813-smoke-n&lt;br /&gt;
|AuthorName=SmOke_N&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; ArraySortNum(ByRef $nArray, $Ascending = 0, $Start = 1)&lt;br /&gt;
; Sorts arrays based on TRUE Numerical Order, including Decimals&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Example sort Array created with StringSplit.&lt;br /&gt;
Global $avArray = StringSplit(&amp;quot;6,8,10,4,2,13,12,129,106.1,106.4&amp;quot;, &amp;quot;,&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
_ArraySortNum($avArray, 1)&lt;br /&gt;
_ArrayDisplay($avArray, &amp;quot;Sorted Desc starting at 1&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Func _ArraySortNum(ByRef $nArray, $Ascending = 0, $Start = 1)&lt;br /&gt;
	For $i = $Start To UBound($nArray) - 2&lt;br /&gt;
		Local $SE = $i&lt;br /&gt;
&lt;br /&gt;
		If $Ascending = 0 Then&lt;br /&gt;
			For $x = $i To UBound($nArray) - 1&lt;br /&gt;
				If Number($nArray[$SE]) &amp;lt; Number($nArray[$x]) Then $SE = $x&lt;br /&gt;
			Next&lt;br /&gt;
		Else&lt;br /&gt;
			For $x = $i To UBound($nArray) - 1&lt;br /&gt;
				If Number($nArray[$SE]) &amp;gt; Number($nArray[$x]) Then $SE = $x&lt;br /&gt;
			Next&lt;br /&gt;
		EndIf&lt;br /&gt;
&lt;br /&gt;
		Local $HLD = $nArray[$i]&lt;br /&gt;
&lt;br /&gt;
		$nArray[$i] = $nArray[$SE]&lt;br /&gt;
&lt;br /&gt;
		$nArray[$SE] = $HLD&lt;br /&gt;
	Next&lt;br /&gt;
EndFunc   ;==&amp;gt;_ArraySortNum&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _AssocArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=31149-milesahead&lt;br /&gt;
|AuthorName=MilesAhead&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; use Scripting.Dictionary object for simple associative arrays&lt;br /&gt;
; with string keys. Key comparisons are case insensitive.&lt;br /&gt;
&lt;br /&gt;
Global $myArray&lt;br /&gt;
$myArray = _AssocArray()&lt;br /&gt;
If @error Then&lt;br /&gt;
    MsgBox(0x1010,&amp;quot;_AssocArray() Error&amp;quot;, &amp;quot;Error Creating Associative Array!&amp;quot;)&lt;br /&gt;
    Exit&lt;br /&gt;
EndIf&lt;br /&gt;
&lt;br /&gt;
$myArray(&amp;quot;AntiqueWhite&amp;quot;) = 0xFAEBD7&lt;br /&gt;
$myArray(&amp;quot;Black&amp;quot;) = 0x000000&lt;br /&gt;
$myArray(&amp;quot;Blue&amp;quot;) = 0x0000FF&lt;br /&gt;
$myArray(&amp;quot;Brown&amp;quot;) = 0xA52A2A&lt;br /&gt;
$myArray(&amp;quot;CadetBlue&amp;quot;) = 0x5F9EA0&lt;br /&gt;
$myArray(&amp;quot;Chocolate&amp;quot;) = 0xD2691E&lt;br /&gt;
$myArray(&amp;quot;Coral&amp;quot;) = 0xFF7F50&lt;br /&gt;
&lt;br /&gt;
MsgBox(0x1040,&amp;quot;&amp;quot;,&amp;quot;Hex for Chocolate Color is: 0x&amp;quot; &amp;amp; Hex($myArray(&amp;quot;Chocolate&amp;quot;),6))&lt;br /&gt;
_AssocArrayDestroy($myArray)&lt;br /&gt;
&lt;br /&gt;
Func _AssocArray()&lt;br /&gt;
    Local $aArray = ObjCreate(&amp;quot;Scripting.Dictionary&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(1, 0, 0)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    $aArray.CompareMode = 1&lt;br /&gt;
&lt;br /&gt;
    Return $aArray&lt;br /&gt;
EndFunc   ;==&amp;gt;_AssocArray&lt;br /&gt;
&lt;br /&gt;
Func _AssocArrayDestroy(ByRef $aArray)&lt;br /&gt;
    If Not IsObj($aArray) Then&lt;br /&gt;
        Return False&lt;br /&gt;
    EndIf&lt;br /&gt;
    $aArray.RemoveAll()&lt;br /&gt;
    $aArray = 0&lt;br /&gt;
    Return True&lt;br /&gt;
EndFunc   ;==&amp;gt;_AssocArrayDestroy&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _FuncListToArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=52-geosoft&lt;br /&gt;
|AuthorName=GEOSoft&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
$aFlist = _FuncListToArray(@ScriptFullPath)&lt;br /&gt;
If NOT @Error Then&lt;br /&gt;
   For $i = 0 To Ubound($aFlist) -1&lt;br /&gt;
      MsgBox(0, &amp;quot;TEST&amp;quot;, $aFlist[$i], 2)&lt;br /&gt;
   Next&lt;br /&gt;
EndIf&lt;br /&gt;
&lt;br /&gt;
Func _FuncListToArray($sStr)&lt;br /&gt;
   If FileExists($sStr) Then $sStr = FileRead($sStr)&lt;br /&gt;
   Local $sRegEx = &amp;quot;(?i)(?m:^|\n)\s*Func\s+(\w+)\s*\(&amp;quot;&lt;br /&gt;
   $aRegEx = StringRegExp($sStr, $sRegEx, 3)&lt;br /&gt;
   If IsArray($aRegEx) Then Return $aRegEx&lt;br /&gt;
   Return SetError(1)&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Identify Duplicate Values In Arrays ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=1967-garyfrost&lt;br /&gt;
|AuthorName=GaryFrost&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Identify Duplicate Values In Arrays&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $a1[3] = [1, 2, 3], $a2[5] = [5, 6, 7, 8, 9], $a3[2] = [3, 5]&lt;br /&gt;
Global $a_a[4] = [3, $a1, $a2, $a3]&lt;br /&gt;
MsgBox(0, &amp;quot;Dupes?&amp;quot;, _SearchForDupes($a_a))&lt;br /&gt;
&lt;br /&gt;
Func _SearchForDupes($a_arrays, $i_ReturnType = 0)&lt;br /&gt;
	Local $Dupes[1] = [0]&lt;br /&gt;
&lt;br /&gt;
	If $a_arrays[0] &amp;lt; 2 Then Return &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
	For $i = 1 To $a_a[0] - 1&lt;br /&gt;
		For $j = $i + 1 To $a_a[0]&lt;br /&gt;
			_FindDupe($a_a[$i], $a_a[$j], $Dupes)&lt;br /&gt;
		Next&lt;br /&gt;
	Next&lt;br /&gt;
&lt;br /&gt;
	If $Dupes[0] = 0 Then Return &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
	_ArraySort($Dupes)&lt;br /&gt;
&lt;br /&gt;
	If Not $i_ReturnType Then&lt;br /&gt;
		Local $s_return = &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
		For $x = 1 To $Dupes[0]&lt;br /&gt;
			$s_return &amp;amp;= $Dupes[$x] &amp;amp; &#039;,&#039;&lt;br /&gt;
		Next&lt;br /&gt;
		Return StringTrimRight($s_return, 1)&lt;br /&gt;
	Else&lt;br /&gt;
		Return $Dupes&lt;br /&gt;
	EndIf&lt;br /&gt;
EndFunc   ;==&amp;gt;_SearchForDupes&lt;br /&gt;
&lt;br /&gt;
Func _FindDupe(ByRef $a_array01, ByRef $a_array02, ByRef $Dupes)&lt;br /&gt;
	Local $found = False&lt;br /&gt;
&lt;br /&gt;
	For $i = 0 To UBound($a_array01) - 1&lt;br /&gt;
		For $j = 0 To UBound($a_array02) - 1&lt;br /&gt;
			If $a_array01[$i] = $a_array02[$j] Then&lt;br /&gt;
				$found = False&lt;br /&gt;
&lt;br /&gt;
				For $x = 1 To $Dupes[0]&lt;br /&gt;
					If $Dupes[$x] = $a_array01[$i] Then&lt;br /&gt;
						$found = True&lt;br /&gt;
						ExitLoop&lt;br /&gt;
					EndIf&lt;br /&gt;
				Next&lt;br /&gt;
&lt;br /&gt;
				If Not $found Then&lt;br /&gt;
					$Dupes[0] += 1&lt;br /&gt;
					ReDim $Dupes[$Dupes[0] + 1]&lt;br /&gt;
					$Dupes[$Dupes[0]] = $a_array01[$i]&lt;br /&gt;
				EndIf&lt;br /&gt;
			EndIf&lt;br /&gt;
		Next&lt;br /&gt;
	Next&lt;br /&gt;
EndFunc   ;==&amp;gt;_FindDupe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _Is1DArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;Local $sString = &#039;String&#039;&lt;br /&gt;
Local $a1DArray[2] = [1, &#039;Row_1&#039;]&lt;br /&gt;
Local $a2DArray[2][2] = [[1],[&#039;Row_1: Col_1&#039;, &#039;Row_1: Col_2&#039;]]&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $sString a 1D Array?: &#039; &amp;amp; _Is1DArray($sString) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $a1DArray a 1D Array?: &#039; &amp;amp; _Is1DArray($a1DArray) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $a2DArray a 1D Array?: &#039; &amp;amp; _Is1DArray($a2DArray) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Check if a variable is a 1D Array.&lt;br /&gt;
Func _Is1DArray(ByRef Const $aArray)&lt;br /&gt;
	Return UBound($aArray) And (UBound($aArray, 0) = 1)&lt;br /&gt;
EndFunc   ;==&amp;gt;_Is1DArray&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _Is2DArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
|Desc=Check if a variable is a 2D Array.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;Local $sString = &#039;String&#039;&lt;br /&gt;
Local $a1DArray[2] = [1, &#039;Row_1&#039;]&lt;br /&gt;
Local $a2DArray[2][2] = [[1],[&#039;Row_1: Col_1&#039;, &#039;Row_1: Col_2&#039;]]&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $sString a 1D Array?: &#039; &amp;amp; _Is2DArray($sString) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $a1DArray a 1D Array?: &#039; &amp;amp; _Is2DArray($a1DArray) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(&#039;Is the variable $a2DArray a 1D Array?: &#039; &amp;amp; _Is2DArray($a2DArray) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Check if a variable is a 2D Array.&lt;br /&gt;
Func _Is2DArray(ByRef Const $aArray)&lt;br /&gt;
	Return UBound($aArray) And (UBound($aArray, 0) = 2)&lt;br /&gt;
EndFunc   ;==&amp;gt;_Is2DArray&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsInBounds ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=35302-guinness&lt;br /&gt;
|AuthorName=guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;#include &amp;lt;Constants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Local $aArray[5] = [&#039;Item_1&#039;, &#039;Item_2&#039;, &#039;Item_3&#039;, &#039;Item_4&#039;, &#039;Item_5&#039;]&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_IsInBounds($aArray, 1) &amp;amp; @CRLF) ; Returns True as the Array has 5 items.&lt;br /&gt;
ConsoleWrite(_IsInBounds($aArray, 5) &amp;amp; @CRLF) ; Returns False as the Array has 5 items but starts from the 0th index not 1st.&lt;br /&gt;
ConsoleWrite(_IsInBounds($aArray, 0) &amp;amp; @CRLF) ; Returns True.&lt;br /&gt;
&lt;br /&gt;
If _IsInBounds($aArray, 4) Then&lt;br /&gt;
	MsgBox($MB_SYSTEMMODAL, &#039;&#039;, &#039;Position 4 contains the value: &amp;quot;&#039; &amp;amp; $aArray[4] &amp;amp; &#039;&amp;quot;&#039;)&lt;br /&gt;
EndIf&lt;br /&gt;
&lt;br /&gt;
Func _IsInBounds(ByRef Const $aArray, $iIndex)&lt;br /&gt;
	Local $iDim = UBound($aArray, 0)&lt;br /&gt;
	If $iDim &amp;lt; 0 Or $iDim &amp;gt; 2 Then ; If not a 1D or 2D Array, then return -1 and set @error to non-zero.&lt;br /&gt;
		Return SetError(1, 0, False)&lt;br /&gt;
	EndIf&lt;br /&gt;
	Return $iIndex &amp;lt; UBound($aArray, 1)&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsInBounds&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _MultiFileListToArray ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=4920-valuater&lt;br /&gt;
|AuthorName=Valuater&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Multiple File List to Array&lt;br /&gt;
&lt;br /&gt;
$Files_List = _MultiFileListToArray(@ScriptDir, &amp;quot;*.txt|*.ini&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
; for display only&lt;br /&gt;
$GUI = GUICreate(&amp;quot; _MultiFileListToArray - DEMO&amp;quot;)&lt;br /&gt;
$Edit1 = GUICtrlCreateEdit(&amp;quot;&amp;quot;, 50, 50, 300, 300)&lt;br /&gt;
For $x = 1 To UBound($Files_List) - 1&lt;br /&gt;
    GUICtrlSetData(-1, $Files_List[$x] &amp;amp; @CRLF, 1)&lt;br /&gt;
Next&lt;br /&gt;
GUISetState()&lt;br /&gt;
&lt;br /&gt;
While GUIGetMsg() &amp;lt;&amp;gt; -3&lt;br /&gt;
WEnd&lt;br /&gt;
; end display only&lt;br /&gt;
&lt;br /&gt;
Func _MultiFileListToArray($sPath, $sFilter = &amp;quot;*&amp;quot;, $iFlag = 0)&lt;br /&gt;
    Local $hSearch, $sFile, $asFileList[1], $sCount&lt;br /&gt;
    If Not FileExists($sPath) Then Return SetError(1, 1, &amp;quot;&amp;quot;)&lt;br /&gt;
    If (StringInStr($sFilter, &amp;quot;\&amp;quot;)) Or (StringInStr($sFilter, &amp;quot;/&amp;quot;)) Or (StringInStr($sFilter, &amp;quot;:&amp;quot;)) Or (StringInStr($sFilter, &amp;quot;&amp;gt;&amp;quot;)) Or (StringInStr($sFilter, &amp;quot;&amp;lt;&amp;quot;)) Or (StringStripWS($sFilter, 8) = &amp;quot;&amp;quot;) Then Return SetError(2, 2, &amp;quot;&amp;quot;)&lt;br /&gt;
    $sFilter = (StringSplit($sFilter, &amp;quot;|&amp;quot;))&lt;br /&gt;
    If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, &amp;quot;&amp;quot;)&lt;br /&gt;
    For $sCount = 1 To $sFilter[0]&lt;br /&gt;
        $hSearch = FileFindFirstFile($sPath &amp;amp; &amp;quot;\&amp;quot; &amp;amp; $sFilter[$sCount])&lt;br /&gt;
        If $hSearch = -1 Then&lt;br /&gt;
            If $sCount = $sFilter[0] Then Return SetError(4, 4, $asFileList)&lt;br /&gt;
            ContinueLoop&lt;br /&gt;
        EndIf&lt;br /&gt;
        While 1&lt;br /&gt;
            $sFile = FileFindNextFile($hSearch)&lt;br /&gt;
            If @error Then&lt;br /&gt;
                SetError(0)&lt;br /&gt;
                ExitLoop&lt;br /&gt;
            EndIf&lt;br /&gt;
            If $iFlag = 1 And StringInStr(FileGetAttrib($sPath &amp;amp; &amp;quot;\&amp;quot; &amp;amp; $sFile), &amp;quot;D&amp;quot;) &amp;lt;&amp;gt; 0 Then ContinueLoop&lt;br /&gt;
            If $iFlag = 2 And StringInStr(FileGetAttrib($sPath &amp;amp; &amp;quot;\&amp;quot; &amp;amp; $sFile), &amp;quot;D&amp;quot;) = 0 Then ContinueLoop&lt;br /&gt;
            ReDim $asFileList[UBound($asFileList) + 1]&lt;br /&gt;
            $asFileList[0] = $asFileList[0] + 1&lt;br /&gt;
            $asFileList[UBound($asFileList) - 1] = $sFile&lt;br /&gt;
        WEnd&lt;br /&gt;
        FileClose($hSearch)&lt;br /&gt;
    Next&lt;br /&gt;
    Return $asFileList&lt;br /&gt;
EndFunc   ;==&amp;gt;_MultiFileListToArray&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Return Min or Max Number From One or Two Arrays ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
|AuthorURL=1967-garyfrost&lt;br /&gt;
|AuthorName=GaryFrost&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Func _MinMaxa($a_nums01, $MaxFlag = 0, $a_nums02 = 0)&lt;br /&gt;
   If Not IsArray($a_nums01) Then&lt;br /&gt;
      SetError(1)&lt;br /&gt;
      Return (0)&lt;br /&gt;
   EndIf&lt;br /&gt;
&lt;br /&gt;
   If @NumParams = 3 Then&lt;br /&gt;
      If Not IsArray($a_nums02) Then&lt;br /&gt;
         SetError(3)&lt;br /&gt;
         Return (0)&lt;br /&gt;
      EndIf&lt;br /&gt;
   EndIf&lt;br /&gt;
&lt;br /&gt;
   Local $idx&lt;br /&gt;
&lt;br /&gt;
   For $idx = 0 To UBound($a_nums01) - 1&lt;br /&gt;
      If StringIsFloat($a_nums01[$idx]) Or StringIsInt($a_nums01[$idx]) Then&lt;br /&gt;
         $a_nums01[$idx] = Number($a_nums01[$idx])&lt;br /&gt;
      Else&lt;br /&gt;
         SetError(2)&lt;br /&gt;
         Return (0)&lt;br /&gt;
      EndIf&lt;br /&gt;
   Next&lt;br /&gt;
&lt;br /&gt;
   _ArraySort($a_nums01, $MaxFlag)&lt;br /&gt;
&lt;br /&gt;
   If @NumParams = 3 Then&lt;br /&gt;
      For $idx = 0 To UBound($a_nums02) - 1&lt;br /&gt;
         If StringIsFloat($a_nums02[$idx]) Or StringIsInt($a_nums02[$idx]) Then&lt;br /&gt;
            $a_nums02[$idx] = Number($a_nums02[$idx])&lt;br /&gt;
         Else&lt;br /&gt;
            SetError(4)&lt;br /&gt;
            Return (0)&lt;br /&gt;
         EndIf&lt;br /&gt;
	  Next&lt;br /&gt;
&lt;br /&gt;
      _ArraySort($a_nums02, $MaxFlag)&lt;br /&gt;
&lt;br /&gt;
	  If $MaxFlag Then&lt;br /&gt;
         If Number($a_nums01[0]) &amp;gt; Number($a_nums02[0]) Then&lt;br /&gt;
            Return $a_nums01[0]&lt;br /&gt;
         Else&lt;br /&gt;
            Return $a_nums02[0]&lt;br /&gt;
         EndIf&lt;br /&gt;
      Else&lt;br /&gt;
         If Number($a_nums01[0]) &amp;lt; Number($a_nums02[0]) Then&lt;br /&gt;
            Return $a_nums01[0]&lt;br /&gt;
         Else&lt;br /&gt;
            Return $a_nums02[0]&lt;br /&gt;
         EndIf&lt;br /&gt;
      EndIf&lt;br /&gt;
   EndIf&lt;br /&gt;
&lt;br /&gt;
   Return $a_nums01[0]&lt;br /&gt;
EndFunc ;==&amp;gt;_MinMaxa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;/div&gt;</summary>
		<author><name>DatMCEyeBall</name></author>
	</entry>
</feed>