Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/14/2023 in all areas

  1. ? #include <array.au3> #include <Excel.au3> Global $oExcel = _Excel_Open(False) Global $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir&"\E.xlsx", False, False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "", "Error opening E.xlsx") $value = "2" $a = StringRegExp(_ArrayToString(_Excel_RangeRead($oWorkbook)), '(?m)^(?:[^\|]*\|){5}' & $value & '\|.*$', 3) Local $res[0][12] For $i = 0 to UBound($a)-1 _ArrayAdd($res, $a[$i]) Next _ArrayDisplay($res)
    3 points
  2. Of course you can Once the $aExcel array is converted to a string then you can use StringSplit, details below #include <array.au3> #include <Excel.au3> Global $oExcel = _Excel_Open(False) Global $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir&"\E.xlsx", False, False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "", "Error opening E.xlsx") Local $value = "2", $col = 5 $aExcel = _Excel_RangeRead($oWorkbook) Local $res[0][UBound($aExcel, 2)] $txt = _ArrayToString($aExcel) #cs $a = StringRegExp($txt, '(?m)^(?:[^\|]*\|){' & $col & '}' & $value & '\|.*$', 3) For $i = 0 to UBound($a)-1 _ArrayAdd($res, $a[$i]) Next #ce $rows = StringSplit($txt, @crlf, 1) For $i = 1 to $rows[0] $cells = StringSplit($rows[$i], "|", 2) If $cells[$col] = $value Then _ArrayAdd($res, $rows[$i]) Next _ArrayDisplay($res)
    1 point
  3. 1 point
  4. I think OP would like to easily extract some non-contiguous full rows from an array, when the row indices are indicated in an external 1D array. For example something like this, using... a non-existant function : Local $aExtract = _ArrayExtractEx($aExcel, $aIndices) IIRC Melba23 added this functionality to _ArrayDelete (and _ArrayInsert too ?), I mean the possibility of using a range of indices in a 1D array. By the way, OP used this functionality when he scripted : _ArrayDelete($aExcel, $Find) $Find being a 1D array of indices, returned by _ArrayFindAll Of course it should be easy for OP to extract these full rows in a loop, based on the $Find array, but it would be easier with a one liner. But wait... maybe it's already possible and I missed it, everything is possible
    1 point
  5. Thanks to TheSaint and Jokky !!! For the last 2-3 days I have been running around in coding circles. I too, wanted to monitor download progress by checking file size repeatedly. I too, noticed that WinExplorer does not refresh itself, so that didn't work. What I did notice was that if I manually checked the file's Properties, I could see the correct, current size. But even then, WinExplorer did not refresh itself even tho I had righclicked the actual file inside the WinExplorer window! Wasted LOTS of time trying to find a way to make WinExplorer refresh itself and trying to check file Properties. Luckily I found this 7 year old discussion of FileBuffers needing refreshing. But you need Handle to the actual file to do that. Again, thanks for showing me how to do both. Tony4219
    1 point
  6. Hi @ioa747, I will have a look at your topic here later on. First view: interesting, but I am not sure about the use cases yet. Let's see, after reading this again and a tryout 😀 . Best regards Sven
    1 point
×
×
  • Create New...