Jump to content

Leaderboard

Popular Content

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

  1. Jon

    AutoIt v3.3.10.0 Released

    Updated to v3.3.10.2. Fixed the issues with running on Windows XP RTM and Althon XP processors.   Download it here. Complete list of changes: History
    2 points
  2. spudw2k

    $label15 + $i

    I think execute could be used almost interchangeably with Eval in the example above, but I could be wrong. AFAIK you can use Execute to refer to a variable no matter what type it is...Object, Array, Control, etc. In this very confusing example I use Execute to perform data extraction from any size array. Local $arr[]=["Never","Gonna","Give","You","Up"] ConsoleWrite(_DynEnumArray($arr) & @CRLF) Local $arr[][]=[["Penn", "Teller"],["Gilbert", "Sullivan"],["Sonny", "Cher"],["Stone", "Parker"],["Fischbacher", "Horn"],["Plant", "Page"]] ConsoleWrite(_DynEnumArray($arr) & @CRLF) Local $arr[][][]=[[["All","Your"],["Base","Are"],["Belong","To Us"]],[["Is","This"],["The","Way"],["Back","Home"]]] ConsoleWrite(_DynEnumArray($arr) & @CRLF) Func _DynEnumArray(ByRef $array) If Not IsArray($array) then Return SetError(1,0,"") ;Make sure parameter IsArray Local $aDims[1][2]=[["ElementIdx","ElementCount"]] ;Create an array to track Source array dimensions and elements Local $sArrayContents = "" ;Create empty result string for Source array contents For $iX = 1 to UBound($array,0) ;Get Source array size and save in tracking array ReDim $aDims[$iX+1][2] $aDims[$iX][0]=0 $aDims[$iX][1]=UBound($array,$iX) Next Do ;Loop through Source array elements $var = "" For $iX = 1 to UBound($aDims)-1 ;Build array dimension string $var &= "[" & $aDims[$iX][0] & "]" Next $sArrayContents &= $var & " " & Execute("$array" & $var) & @CRLF ;Evaluate array dimension string and append contents to result string $aDims[UBound($aDims)-1][0] += 1 ;Increment last dimension element in tracking array For $iY = UBound($aDims)-2 To 1 Step -1 ;Increment dimension element in tracking array If $aDims[$iY+1][0] = $aDims[$iY+1][1] Then $aDims[$iY+1][0]=0 $aDims[$iY][0]+=1 EndIf Next Until $aDims[1][0]=$aDims[1][1] ;Loop until Source array element enumeration is complete Return $sArrayContents EndFunc I first learned about Execute >in this thread when I was dealing with using Object properties.
    1 point
  3. DatMCEyeBall, I would rather suggest: #AutoIt3Wrapper_Autoit3Dir= because then you can have as many versions available as you wish (I once had 4). But if you only have 2 versions, the SciTE4AutoIt3 Prod/Beta menu items and short-cut method is the easiest solution. M23
    1 point
  4. James

    Static & Global

    Global Const $SUP_DAWG = "I'm immutable! Come at me bro!" Global Static $SUP_HOMEBOI = "U wat blud? I'll mutable you in a minute" ; P.s, he won't because Const can't be changed.
    1 point
  5. DatMCEyeBall

    Static & Global

    *YO_IMA_CONTSTANT_DAWG
    1 point
  6. Done..! Happy New Year and Merry Christmas
    1 point
  7. Here is an example where it could be argued that using variables for function names makes for simpler code. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Martin\Documents\MG AutoIt\play\varFunc1.kxf $Form2 = GUICreate("Form2", 376, 287, 538, 208) GUISetFont(10, 400, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("", 80, 8, 121, 28) $Label1 = GUICtrlCreateLabel("Input", 32, 8, 40, 24) $Button1 = GUICtrlCreateButton("square", 232, 8, 107, 25) $Button2 = GUICtrlCreateButton("cube", 232, 50, 107, 25) $Button3 = GUICtrlCreateButton("square root", 232, 92, 107, 25) $Button4 = GUICtrlCreateButton("cube root", 232, 134, 107, 25) $Button5 = GUICtrlCreateButton("invert answer", 232, 176, 107, 25) $Input2 = GUICtrlCreateInput("", 80, 176, 121, 28, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY)) $Label2 = GUICtrlCreateLabel("answer", 13, 178, 58, 24) $Label3 = GUICtrlCreateLabel("", 32, 224, 310, 24, $SS_CENTER) $Checkbox1 = GUICtrlCreateCheckbox("use function variables", 32, 88, 153, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### const $sMethod[2] = ['Conventional','using functions as variables'] Global $aFuncs[5] = [funcBut1, funcBut2, funcBut3, funcBut4, funcBut5] While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $button1 to $Button5 if GUICtrlRead($Checkbox1) <> $GUI_CHECKED Then method1($nMsg) Else method2($nMsg) EndIf EndSwitch WEnd Func method1($msg1);using conventional logic<<<<<<<<<<<<<<<<<<< Switch $msg1 Case $Button1 funcBut1($sMethod[0]) Case $Button2 funcBut2($sMethod[0]) Case $Button3 funcBut3($sMethod[0]) Case $Button4 funcBut4($sMethod[0]) Case $Button5 funcBut5($sMethod[0]) EndSwitch EndFunc ;==>method1 Func method2($msg1);using function names as variables<<<<<<<<<<<< $aFuncs[$msg1 - $Button1]($sMethod[1]) EndFunc ;==>method2 func funcBut1($style) setAns(GUICtrlRead($input1) ^2,$style) EndFunc func funcBut2($style) setAns(GUICtrlRead($input1) ^3,$style) EndFunc func funcBut3($style) setAns(GUICtrlRead($input1) ^0.5,$style) EndFunc func funcBut4($style) setAns(GUICtrlRead($input1) ^(1/3),$style) EndFunc func funcBut5($style) setAns(GUICtrlRead($input2) ^ -1,$style) EndFunc func setAns($Res, $sText) GUICtrlSetData($input2,stringformat("%8.3f",$Res)) GUICtrlSetData($label3,$sText) EndFunc
    1 point
  8. Melba23

    Static & Global

    DatMCEyeBall, Then please do us all a favour and do not post untested code snippets again when there is a serious discussion ongoing - particularly when it is a subject about which you evidently have absolutely no understanding at all. M23
    1 point
  9. The short answer is that you only get the last capture when the pattern looks like (whatever)* There is only one capture slot allocated for the return and it is overriden successively by multiple sub-matches. The problem is with escaped quotes inside a string. A string without escaped (doubled) quotes (let's call that a partial string) is defined by ( ['"] ) [^\g-1]*? \g-1 but if you enclose this pattern by ()* you only retain the last capture. Instead a generic AutoIt string is ( (?: ( ['"] ) [^\g-1]*? \g-1 )* ) Note that we don't fear "abc" being contiguous to 'def' as string quotes need to be consistent. So the actual pattern could be: (?mx) ^ ( [^'";]* ) ( [^'";]* ( (?: ( ['"] ) [^\g-1]*? \g-1 )* ) ) \s* ; .* $
    1 point
  10. Don't quit your day job.
    1 point
  11. The only thing HUGE in AutoIt, is the large community of appreciative users. *drops the mic and walks off stage.*
    1 point
  12. Jon

    AutoIt v3.3.10.0 Released

    Updated to v3.3.10.1. Just some minor changes and missing comments in the script breaking changes section. Download it here. Complete list of changes: History
    1 point
×
×
  • Create New...