Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

UDF - File - _FileWriteFromArray

$
0
0

Hi everybody,

 

I was trying to use that function in a little archive I'm building, when I stumbled in an error. Looks to me like the function does care and check if the array's dimensions are more than 2. But after that seems not to care about how long is the second dimension, when present.

Especially the CASE2 inside the switch doesn't seem to care.

I added another variable to the function, and now the save seems to go allright. But I wished to know if that could be done better, since I'm just a beginning coder. Anyway, here it goes.
 

AutoIt         
    Switch $iDims         Case 1             For $x = $i_Base To $i_UBound                 If FileWrite($hFile, $a_Array[$x] & @CRLF) = 0 Then                     $ErrorSav = 3                     ExitLoop                 EndIf             Next          Case 2             Local $iDim2             $iDim2 = UBound($a_Array, $iDims) - 2             Local $s_Temp             For $x = $i_Base To $i_UBound                 $s_Temp = $a_Array[$x][0]                 For $y = 1 To $iDim2                     $s_Temp &= $s_Delim & $a_Array[$x][$y]                     Next                 If FileWrite($hFile, $s_Temp & @CRLF) = 0 Then                     $ErrorSav = 3                     ExitLoop                 EndIf             Next     EndSwitch

What do you think?

 

Take care


 


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>