Jump to content

Leaderboard

Popular Content

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

  1. For the fun of it : #include <Array.au3> Opt ("MustDeclareVars", 1) Local $sJson = '{"Application":[{"ApplicationName":"Angry Birds Go!","ApplicationSize":"436.56 MB","ApplicationUrl":"https://itunes.apple.com/us/app/angry-birds-go!/id642821482?mt=8&uo=4","Assignments":[{"Status":"Active","SmartGroupId":4193,"LocationGroupId":"0","Users":0,"Allocated":1,"Redeemed":0,"AssignmentRuleType":"License"}],"BundleId":"com.rovio.angrybirdsgo","IsReimbursable":false,"LargeIconUri":"","MediumIconUri":"","SmallIconUri":"","LocationGroupId":1098,"Platform":2,"ManagedDistribution":{"Purchased":1,"Burned":0,"OnHold":0,"Available":1,"AppLicenseEligibility":"Device"},"Deployment":{"AssignmentType":"OnDemand","RemoveOnUnenroll":true,"PreventApplicationBackup":true,"UseVPN":false},"AppType":"Purchased","AssignmentStatus":"Assigned","IsAutoUpdateEnabled":false,"Id":{"Value":140}}],"Page":0,"PageSize":500,"Total":1}' ClipPut ($sJson) $sJson = StringRegExpReplace ($sJson, '(https?)(:)\/\/', "$1;\/\/") Local $aArray = StringSplit ($sJson, ":,{", $STR_CHRSPLIT) ;_ArrayDisplay ($aArray) Local $aFinal[Round($aArray[0]/2)][2], $iStart = 0, $iFinal = 0 Local $sP1, $sP2 While True $iStart += 2 If $iStart > $aArray[0] Then ExitLoop $sP1 = $aArray[$iStart] $sP2 = StringRegExpReplace ($aArray[$iStart+1],"}*]*$","") If $sP2 = "" or $sP2 = "[" Then ContinueLoop $aFinal[$iFinal][0] = $sP1 $aFinal[$iFinal][1] = $sP2 $iFinal += 1 WEnd redim $aFinal[$iFinal][2] _ArrayDisplay ($aFinal)
    1 point
  2. Note : My reaction "" was intended to be friendly, not pejorative. In retrospect, I probably should have taken a "Like" instead. Anyway : I wish you a happy new year 2020
    1 point
  3. NVM.... found the stupid underscore.
    1 point
  4. AutoItX just provides a subset of the features of AutoIt. So It's sure that will not the only issue you will find while working with it. Saludos
    1 point
  5. Warning , typo inside @pixelsearch Both solutions work but I personally prefer the first one because it matches the requirement strictly
    1 point
  6. I doubt that your request for assistance could have been much more vague. What is it that you want help with? Do you want help retrieving the JSON using AutoIt natively instead of using a CURL command? Do you want help parsing the data that you are already retrieving using the CURL command? If it is help parsing the JSON data, what values from the result are you wanting to parse? Or is it that you need help understanding how to use the json or xml UDFs? The more specific your request is, the more likely you will be to get someone interested enough to help you. Just throwing some vague request out there, without specifying any details on what you need help with, will most likely just get ignored -- which is probably what I should have done. What have you tried in your efforts to accomplish your goal. What exactly are you having a problem understanding? Do you prefer parsing XML or JSON?
    1 point
  7. Nine

    Array and GUICtrlSetState

    You could also increase readability of the button creation like this : Local $av_btn_Production[30], $av_btn_Shadow[30], $av_btn_QA[30], $iInd $iInd = 0 For $y = 0 To 9 For $x = 0 To 2 $av_btn_Production[$iInd] = GUICtrlCreateButton("Production_" & StringFormat("%02i", $iInd + 1), 10 + 270 * $x, 70 + 50 * $y, 270, 50) GUICtrlSetState(-1, $GUI_HIDE) $iInd += 1 Next Next $iInd = 0 For $y = 0 To 9 For $x = 0 To 2 $av_btn_Shadow[$iInd] = GUICtrlCreateButton("Shadow_" & StringFormat("%02i", $iInd + 1), 10 + 270 * $x, 70 + 50 * $y, 270, 50) GUICtrlSetState(-1, $GUI_HIDE) $iInd += 1 Next Next $iInd = 0 For $y = 0 To 9 For $x = 0 To 2 $av_btn_QA[$iInd] = GUICtrlCreateButton("QA_" & StringFormat("%02i", $iInd + 1), 10 + 270 * $x, 70 + 50 * $y, 270, 50) GUICtrlSetState(-1, $GUI_HIDE) $iInd += 1 Next Next
    1 point
  8. Musashi

    Array and GUICtrlSetState

    Hi @FrancescoDiMuro : I would add a check to see if $Environment has changed. Otherwise the message boxes are permanently redrawn, which causes flickering. #Region ---Head-- #include <Constants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <ComboConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> ; Declaring three Global arrays of 30 elements Global $arrProductionButtons[30] Global $arrShadowButtons[30] Global $arrQAButtons[30] Global $Environment = "Production" Global $EnvironmentSelected = "Production" Global $bEnvironmentShow = False If _Singleton("JETS", 1) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "JETS is already running!") Exit EndIf $hGUI = GUICreate("JETS", 829, 600, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_MINIMIZEBOX) $Combo_01 = GUICtrlCreateCombo("", 160, 20, 145, 21, -1) GUICtrlSetData($Combo_01, "Production|Shadow|QA", "") $Label_01 = GUICtrlCreateLabel("Select Your Environment:", 20, 25, 140, 30, -1) ; Assigning each control to an element? $arrProductionButtons[0] = GUICtrlCreateButton("Production_01", 10, 70, 270, 50, -1) $arrProductionButtons[1] = GUICtrlCreateButton("Production_02", 280, 70, 270, 50, -1) $arrProductionButtons[2] = GUICtrlCreateButton("Production_03", 550, 70, 270, 50, -1) $arrProductionButtons[3] = GUICtrlCreateButton("Production_04", 10, 120, 270, 50, -1) $arrProductionButtons[4] = GUICtrlCreateButton("Production_05", 280, 120, 270, 50, -1) $arrProductionButtons[5] = GUICtrlCreateButton("Production_06", 550, 120, 270, 50, -1) $arrProductionButtons[6] = GUICtrlCreateButton("Production_07", 10, 170, 270, 50, -1) $arrProductionButtons[7] = GUICtrlCreateButton("Production_08", 280, 170, 270, 50, -1) $arrProductionButtons[8] = GUICtrlCreateButton("Production_09", 550, 170, 270, 50, -1) $arrProductionButtons[9] = GUICtrlCreateButton("Production_10", 10, 220, 270, 50, -1) $arrProductionButtons[10] = GUICtrlCreateButton("Production_11", 280, 220, 270, 50, -1) $arrProductionButtons[11] = GUICtrlCreateButton("Production_12", 550, 220, 270, 50, -1) $arrProductionButtons[12] = GUICtrlCreateButton("Production_13", 10, 270, 270, 50, -1) $arrProductionButtons[13] = GUICtrlCreateButton("Production_14", 280, 270, 270, 50, -1) $arrProductionButtons[14] = GUICtrlCreateButton("Production_15", 550, 270, 270, 50, -1) $arrProductionButtons[15] = GUICtrlCreateButton("Production_16", 10, 320, 270, 50, -1) $arrProductionButtons[16] = GUICtrlCreateButton("Production_17", 280, 320, 270, 50, -1) $arrProductionButtons[17] = GUICtrlCreateButton("Production_18", 550, 320, 270, 50, -1) $arrProductionButtons[18] = GUICtrlCreateButton("Production_19", 10, 370, 270, 50, -1) $arrProductionButtons[19] = GUICtrlCreateButton("Production_20", 280, 370, 270, 50, -1) $arrProductionButtons[20] = GUICtrlCreateButton("Production_21", 550, 370, 270, 50, -1) $arrProductionButtons[21] = GUICtrlCreateButton("Production_22", 10, 420, 270, 50, -1) $arrProductionButtons[22] = GUICtrlCreateButton("Production_23", 280, 420, 270, 50, -1) $arrProductionButtons[23] = GUICtrlCreateButton("Production_24", 550, 420, 270, 50, -1) $arrProductionButtons[24] = GUICtrlCreateButton("Production_25", 10, 470, 270, 50, -1) $arrProductionButtons[25] = GUICtrlCreateButton("Production_26", 280, 470, 270, 50, -1) $arrProductionButtons[26] = GUICtrlCreateButton("Production_27", 550, 470, 270, 50, -1) $arrProductionButtons[27] = GUICtrlCreateButton("Production_28", 10, 520, 270, 50, -1) $arrProductionButtons[28] = GUICtrlCreateButton("Production_29", 280, 520, 270, 50, -1) $arrProductionButtons[29] = GUICtrlCreateButton("Production_30", 550, 520, 270, 50, -1) $arrShadowButtons[0] = GUICtrlCreateButton("Shadow_01", 10, 70, 270, 50, -1) $arrShadowButtons[1] = GUICtrlCreateButton("Shadow_02", 280, 70, 270, 50, -1) $arrShadowButtons[2] = GUICtrlCreateButton("Shadow_03", 550, 70, 270, 50, -1) $arrShadowButtons[3] = GUICtrlCreateButton("Shadow_04", 10, 120, 270, 50, -1) $arrShadowButtons[4] = GUICtrlCreateButton("Shadow_05", 280, 120, 270, 50, -1) $arrShadowButtons[5] = GUICtrlCreateButton("Shadow_06", 550, 120, 270, 50, -1) $arrShadowButtons[6] = GUICtrlCreateButton("Shadow_07", 10, 170, 270, 50, -1) $arrShadowButtons[7] = GUICtrlCreateButton("Shadow_08", 280, 170, 270, 50, -1) $arrShadowButtons[8] = GUICtrlCreateButton("Shadow_09", 550, 170, 270, 50, -1) $arrShadowButtons[9] = GUICtrlCreateButton("Shadow_10", 10, 220, 270, 50, -1) $arrShadowButtons[10] = GUICtrlCreateButton("Shadow_11", 280, 220, 270, 50, -1) $arrShadowButtons[11] = GUICtrlCreateButton("Shadow_12", 550, 220, 270, 50, -1) $arrShadowButtons[12] = GUICtrlCreateButton("Shadow_13", 10, 270, 270, 50, -1) $arrShadowButtons[13] = GUICtrlCreateButton("Shadow_14", 280, 270, 270, 50, -1) $arrShadowButtons[14] = GUICtrlCreateButton("Shadow_15", 550, 270, 270, 50, -1) $arrShadowButtons[15] = GUICtrlCreateButton("Shadow_16", 10, 320, 270, 50, -1) $arrShadowButtons[16] = GUICtrlCreateButton("Shadow_17", 280, 320, 270, 50, -1) $arrShadowButtons[17] = GUICtrlCreateButton("Shadow_18", 550, 320, 270, 50, -1) $arrShadowButtons[18] = GUICtrlCreateButton("Shadow_19", 10, 370, 270, 50, -1) $arrShadowButtons[19] = GUICtrlCreateButton("Shadow_20", 280, 370, 270, 50, -1) $arrShadowButtons[20] = GUICtrlCreateButton("Shadow_21", 550, 370, 270, 50, -1) $arrShadowButtons[21] = GUICtrlCreateButton("Shadow_22", 10, 420, 270, 50, -1) $arrShadowButtons[22] = GUICtrlCreateButton("Shadow_23", 280, 420, 270, 50, -1) $arrShadowButtons[23] = GUICtrlCreateButton("Shadow_24", 550, 420, 270, 50, -1) $arrShadowButtons[24] = GUICtrlCreateButton("Shadow_25", 10, 470, 270, 50, -1) $arrShadowButtons[25] = GUICtrlCreateButton("Shadow_26", 280, 470, 270, 50, -1) $arrShadowButtons[26] = GUICtrlCreateButton("Shadow_27", 550, 470, 270, 50, -1) $arrShadowButtons[27] = GUICtrlCreateButton("Shadow_28", 10, 520, 270, 50, -1) $arrShadowButtons[28] = GUICtrlCreateButton("Shadow_29", 280, 520, 270, 50, -1) $arrShadowButtons[29] = GUICtrlCreateButton("Shadow_00", 550, 520, 270, 50, -1) $arrQAButtons[0] = GUICtrlCreateButton("QA_01", 10, 70, 270, 50, -1) $arrQAButtons[1] = GUICtrlCreateButton("QA_02", 280, 70, 270, 50, -1) $arrQAButtons[2] = GUICtrlCreateButton("QA_03", 550, 70, 270, 50, -1) $arrQAButtons[3] = GUICtrlCreateButton("QA_04", 10, 120, 270, 50, -1) $arrQAButtons[4] = GUICtrlCreateButton("QA_05", 280, 120, 270, 50, -1) $arrQAButtons[5] = GUICtrlCreateButton("QA_06", 550, 120, 270, 50, -1) $arrQAButtons[6] = GUICtrlCreateButton("QA_07", 10, 170, 270, 50, -1) $arrQAButtons[7] = GUICtrlCreateButton("QA_08", 280, 170, 270, 50, -1) $arrQAButtons[8] = GUICtrlCreateButton("QA_09", 550, 170, 270, 50, -1) $arrQAButtons[9] = GUICtrlCreateButton("QA_10", 10, 220, 270, 50, -1) $arrQAButtons[10] = GUICtrlCreateButton("QA_11", 280, 220, 270, 50, -1) $arrQAButtons[11] = GUICtrlCreateButton("QA_12", 550, 220, 270, 50, -1) $arrQAButtons[12] = GUICtrlCreateButton("QA_13", 10, 270, 270, 50, -1) $arrQAButtons[13] = GUICtrlCreateButton("QA_14", 280, 270, 270, 50, -1) $arrQAButtons[14] = GUICtrlCreateButton("QA_15", 550, 270, 270, 50, -1) $arrQAButtons[15] = GUICtrlCreateButton("QA_16", 10, 320, 270, 50, -1) $arrQAButtons[16] = GUICtrlCreateButton("QA_17", 280, 320, 270, 50, -1) $arrQAButtons[17] = GUICtrlCreateButton("QA_18", 550, 320, 270, 50, -1) $arrQAButtons[18] = GUICtrlCreateButton("QA_19", 10, 370, 270, 50, -1) $arrQAButtons[19] = GUICtrlCreateButton("QA_20", 280, 370, 270, 50, -1) $arrQAButtons[20] = GUICtrlCreateButton("QA_21", 550, 370, 270, 50, -1) $arrQAButtons[21] = GUICtrlCreateButton("QA_22", 10, 420, 270, 50, -1) $arrQAButtons[22] = GUICtrlCreateButton("QA_23", 280, 420, 270, 50, -1) $arrQAButtons[23] = GUICtrlCreateButton("QA_24", 550, 420, 270, 50, -1) $arrQAButtons[24] = GUICtrlCreateButton("QA_25", 10, 470, 270, 50, -1) $arrQAButtons[25] = GUICtrlCreateButton("QA_26", 280, 470, 270, 50, -1) $arrQAButtons[26] = GUICtrlCreateButton("QA_27", 550, 470, 270, 50, -1) $arrQAButtons[27] = GUICtrlCreateButton("QA_28", 10, 520, 270, 50, -1) $arrQAButtons[28] = GUICtrlCreateButton("QA_29", 280, 520, 270, 50, -1) $arrQAButtons[29] = GUICtrlCreateButton("QA_30", 550, 520, 270, 50, -1) GUISetState() For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_HIDE) GUICtrlSetState($arrShadowButtons[$i], $GUI_HIDE) GUICtrlSetState($arrQAButtons[$i], $GUI_HIDE) Next #EndRegion ---Head-- #Region --- Form --- #Region --- Loop --- While 1 $msg = GUIGetMsg() $EnvironmentSelected = GUICtrlRead($Combo_01) If $EnvironmentSelected <> $Environment Then $bEnvironmentShow = True $Environment = $EnvironmentSelected ConsoleWrite("< @@DEBUG : New EnvironmentSelected <" & $Environment & "> " & @CRLF) EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ; check if $Environment has changed - otherwise it's flickering If $bEnvironmentShow Then If $Environment = "Production" Then For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_SHOW) GUICtrlSetState($arrShadowButtons[$i], $GUI_HIDE) GUICtrlSetState($arrQAButtons[$i], $GUI_HIDE) Next ElseIf $Environment = "Shadow" Then For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_HIDE) GUICtrlSetState($arrShadowButtons[$i], $GUI_SHOW) GUICtrlSetState($arrQAButtons[$i], $GUI_HIDE) Next ElseIf $Environment = "QA" Then For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_HIDE) GUICtrlSetState($arrShadowButtons[$i], $GUI_HIDE) GUICtrlSetState($arrQAButtons[$i], $GUI_SHOW) Next Else For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_HIDE) GUICtrlSetState($arrShadowButtons[$i], $GUI_HIDE) GUICtrlSetState($arrQAButtons[$i], $GUI_HIDE) Next EndIf $bEnvironmentShow = False EndIf EndSelect WEnd #EndRegion --- Loop --- #Region --- Additional Functions --- #EndRegion --- Additional Functions -- EDIT : The solution of @Subz is better !
    1 point
  9. Subz

    Array and GUICtrlSetState

    Why not just use GuiCtrlSetData? Example #include <Constants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <ComboConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> If _Singleton("JETS", 1) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "JETS is already running!") Exit EndIf Global $y = 70, $aButtons[30][2] $hGUI = GUICreate("JETS", 829, 600, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_MINIMIZEBOX) $Combo_01 = GUICtrlCreateCombo("", 160, 20, 145, 21, -1) GUICtrlSetData($Combo_01, "|Production|Shadow|QA", "") $Label_01 = GUICtrlCreateLabel("Select Your Environment:", 20, 25, 140, 30, -1) For $i = 0 To UBound($aButtons) - 1 Step 3 $aButtons[$i][1] = $i + 1 $aButtons[$i][0] = GUICtrlCreateButton($aButtons[$i][1], 10, $y, 270, 50) $aButtons[$i + 1][1] = $i + 2 $aButtons[$i + 1][0] = GUICtrlCreateButton($aButtons[$i + 1][1], 280, $y, 270, 50) $aButtons[$i + 2][1] = $i + 3 $aButtons[$i + 2][0] = GUICtrlCreateButton($aButtons[$i + 2][1], 550, $y, 270, 50) $y += 50 Next GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Combo_01 For $i = 0 To UBound($aButtons) - 1 If GUICtrlRead($Combo_01) = "" Then GUICtrlSetData($aButtons[$i][0], $i + 1) Else GUICtrlSetData($aButtons[$i][0], GUICtrlRead($Combo_01) & "_" & $i + 1) EndIf Next Case $aButtons[0][0] To $aButtons[UBound($aButtons) - 1][0] Switch GUICtrlRead($Combo_01) Case "Production" MsgBox(4096, "Production Button Clicked", "Production_" & $aButtons[$msg - $aButtons[0][0]][1] & " clicked.") Case "Shadow" MsgBox(4096, "Shadow Button Clicked", "Shadow_" & $aButtons[$msg - $aButtons[0][0]][1] & " clicked.") Case "QA" MsgBox(4096, "QA Button Clicked", "QA_" & $aButtons[$msg - $aButtons[0][0]][1] & " clicked.") Case Else ;~ No Combo item selected ContinueLoop EndSwitch EndSwitch WEnd
    1 point
  10. @Eambo Use an array of controls as showed in the example below:
    1 point
  11. What kind of weird behavior is this? You are asking others for help with a script, but you are not willing to post it 🙄. There is certainly a reason why the forum-rules includes the following sentence :
    1 point
  12. FAMproj\FASudf\Examples\Example.au3 #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include "..\..\FASudf\Includes\SortingWr.au3" FAS_SortingInitVbSrc( "..\..\FASudf\Sources\Sorting.vb" ) ;FAS_SortingInitVbDll( "..\..\FASudf\DLLFiles\SortingVb.dll" ) If @error Then Exit ConsoleWrite( "FAS_SortingInitVbSrc/Dll: @error = " & @error & @CRLF ) #include "..\..\Display\Display.au3" Opt( "MustDeclareVars", 1 ) Example( 100000 ) Example( 250000 ) Example( 500000 ) Example( 750000 ) Example( 1000000 ) ;Example( 2000000 ) ; Try it Func Example( $iRows ) Local $s = StringRegExpReplace( $iRows, "(\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))", "\1," ) & " rows, 6 columns, " _ & StringRegExpReplace( $iRows * 6, "(\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))", "\1," ) & " elements" ConsoleWrite( $s & @CRLF ) ; Create random array Local $aCols = "sifdtr" ; Strings, ints, floats, dates, times, r/c Local $sSource = "TheQuickBrownFoxJumpsOverTheLazyDog" ConsoleWrite( "Create array with random data ..." & @CRLF ) FAS_Random2DArrayWr( $iRows, $aCols, $sSource, 0 ) ; $bRetArray = 0 ; The array is stored as global in compiled code ; Sort by dates and times Local $aCompare1 = [ 3, 4 ] ConsoleWrite( "Sort array by dates and times ..." & @CRLF ) Local $aIndex1 = FAS_Sort2DArrayWr( 0, $aCompare1, 0 ) ; $aArray = 0, $bDelArray = 0 ; Array is not passed to compiled code, not deleted in compiled code ; Sort also by strings Local $aCompare2 = [ [ 0, 1 ] ] ConsoleWrite( "Sort also array by strings ..." & @CRLF ) Local $aIndex2 = FAS_Sort2DArrayWr( 0, $aCompare2, 0 ) ; $aArray = 0, $bDelArray = 0 ; Array is not passed to compiled code, not deleted in compiled code ; Sort also by array index ConsoleWrite( "Sort also array by index ..." & @CRLF ) Local $aIndex3[$iRows] For $i = 0 To $iRows - 1 $aIndex3[$i] = $i Next ; Get array from compiled code ConsoleWrite( "Get array from VB code ..." & @CRLF ) Local $aArray = FAS_Random2DArrayGetWr( $iRows, $aCols ) ; Array is deleted in compiled code ; Display array ConsoleWrite( "Display array ..." & @CRLF & @CRLF ) Local $aSortInfo = [ [ 3, $aIndex1, "" ], _ ; Column 3, dates [ 0, $aIndex2, "" ], _ ; Column 0, strings [ 5, $aIndex3, "" ] ] ; Column 5, row/col Local $aDisplay = Display_GetSort2DArraySortInfo( Display_GetRandom2DArrayFeatures( $aCols ), $aSortInfo ) _ArrayDisplayEx( $aArray, $s, $aDisplay[1], 0, $aDisplay[0] ) ; $sHeader, $aFeatures EndFunc If you haven't already run this example, you should try it. It's a nice example. A random array is created with a varying number of rows and sorted by 3 different columns: dates, strings and a row/col column. Duplicate dates are also sorted by a time column. The sorted array is displayed in a virtual listview. Click header items to switch sorting column. Code optimization is performed with VB.NET code. At the top of first post there is a list of possible optimizations. All of these optimizations are used in the example. The number of array transfers associated with sorting is limited by storing the random array as a global variable in VB code. I'll guess that the code is about 20 times faster than pure AutoIt code. Nevertheless, all .NET and VB code will be removed and replaced by C++ code in new versions of the UDF. The main reason for this is that it takes a really long time to pass arrays back and forth between AutoIt code and VB code. The problem of transferring arrays will be discussed in more detail in a later post. The VB code in the example is much faster than the pure AutoIt code only because the number of array transfers are limited and the code to generate and sort arrays is sufficiently complicated to be of great benefit to the compiled VB code. If the code had been simpler (eg. just moving around elements in an array without performing actual calculations as is the case in the column functions here) the VB code would not have been nearly as fast compared to the AutoIt code. The time saved by using compiled code is spent on transferring arrays. The first version of the UDF contains .NET and VB code to save development time. The .NET and VB code was already implemented in Using C# and VB Code.
    1 point
  13. Please stop bumping and showing little effort. #include <APIConstants.au3> #include <WinAPIEx.au3> While 1 If _IsLocked() Then ConsoleWrite('Workstation Is Locked.' & @CRLF) Else ConsoleWrite('Workstation Not Locked.' & @CRLF) EndIf Sleep(500) WEnd Func _IsLocked() Local $fIsLocked = False Local Const $hDesktop = _WinAPI_OpenDesktop('Default', $DESKTOP_SWITCHDESKTOP) If @error = 0 Then $fIsLocked = Not _WinAPI_SwitchDesktop($hDesktop) _WinAPI_CloseDesktop($hDesktop) EndIf Return $fIsLocked EndFunc ;==>_IsLocked
    1 point
×
×
  • Create New...