Jump to content

Leaderboard

Popular Content

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

  1. Or let AutoIt manage the size of the array: Local $array[][] = [ ['C:\Program Files','12/01/2016','201'], _ ['D:\Au3 Scripts','07/03/2014','301'], _ ['F:\Downloads','01/01/2017','101'] ]
    1 point
  2. Did you do any measures?
    1 point
  3. Thanks weaponx, Still helping folks 8 years after posted!
    1 point
  4. Have you checked the Helpfile whether that is an option or not? Jos
    1 point
  5. Melba23

    how to delete a list item?

    MATISZON, Here you go: Func usunlink() $sName = GUICtrlRead($List1) _GUICtrlListBox_DeleteString($List1, _GUICtrlListBox_GetCaretIndex($List1)) MsgBox(0, "DELETE", $sName & " has been deleted") EndFunc M23
    1 point
  6. That took longer than the one the OP posted originally! 1740 ms
    1 point
  7. No. _ArrayDelete is the slow part.
    1 point
  8. Try this. Yours took 486 ms and I got it down to 30 ms. #include <Array.au3> Dim $aTmp[1000][2] ;Fill array with junk For $X = 0 to 999 ;Insert empty element every 10 nodes, fill the rest with junk If Mod($X,10) = 0 Then $aTmp[$X][0] = "" $aTmp[$X][1] = "" Else $aTmp[$X][0] = "ebgrhrrtbnwrbnwfg" $aTmp[$X][1] = "bwefwergethcbrtgh" EndIf Next _ArrayDisplay($aTmp, "$aTmp_BEFORE") $T1 = TimerInit() ;_Array2DDeleteEmptyRows($aTmp) $aTmp = _DeleteEmptyRows($aTmp) ConsoleWrite("T1: " & TimerDiff($T1) & @CRLF) _ArrayDisplay($aTmp, "$aTmp_AFTER") ;486 ms Func _Array2DDeleteEmptyRows(ByRef $iArray) Local $vEmpty = True For $i = UBound($iArray) - 1 To 0 Step -1 For $j = 0 To UBound($iArray, 2)-1 Step 1 If $iArray[$i][$j] <> "" Then $vEmpty = False EndIf Next If $vEmpty = True Then _ArrayDelete($iArray, $i) $vEmpty = True Next EndFunc ;30 ms Func _DeleteEmptyRows($aArray) Local $Rows = Ubound($aArray,1) Local $Cols = Ubound($aArray,2) Local $aTemp[$Rows][$Cols] Local $not_empty Local $Count = 0 ;Loop through rows For $Y = 0 to $Rows - 1 $not_empty = 0 ;Loop through columns For $X = 0 to $Cols - 1 ;Copy all columns to temp array even if they are all empty $aTemp[$Count][$X] = $aArray[$Y][$X] ;If even one column contains data, make sure it doesn't get deleted If $aArray[$Y][$X] <> "" Then $not_empty = BitOr($not_empty, 1) Next ;If the row has any data, increment, else keep overwriting last row until it contains something If $not_empty Then $Count += 1 Next Redim $aTemp[$Count][$Cols] Return $aTemp EndFunc
    1 point
×
×
  • Create New...