#include<File.au3>
#include <Array.au3>
; размер массива
$aX = 2
$aY = 2
Global $aTest[$aX][$aY] = [[FALSE,2],["Тест","Тест с ' ковычкой"]]
_ArrayDisplay($aTest, "Глобальный массив")
$sFile = @ScriptDir & "\array.txt"
_FileWriteFromArrayEx($sFile, $aTest, 0)
Dim $Array [$aX][$aY]
$ft = FileOpen($sFile, 0)
If $ft = -1 Then
MsgBox(0, "Error", "Невозможно открыть файл.")
Exit
EndIf
$p = 1
for $m = 0 to $aX
$t = FileReadLine($ft, $p)
$s =StringSplit($t,'|')
For $n = 1 to $s[0] -1
$Array[$m][$n-1] = $s[$n + 1]
Next
$p += 1
ConsoleWrite(@LF)
Next
_ArrayDisplay($Array)
FileClose($ft)
Func _FileWriteFromArrayEx($File, $a_Array, $i_Base = 0, $i_UBound = 0, $s_Delim = "|") ; правленая функция с File.au3
; Check if we have a valid array as input
If Not IsArray($a_Array) Then Return SetError(2, 0, 0)
Local $iDims = UBound($a_Array, 0)
If $iDims > 2 Then Return SetError(4, 0, 0)
; determine last entry
Local $last = UBound($a_Array) - 1
If $i_UBound < 1 Or $i_UBound > $last Then $i_UBound = $last
If $i_Base < 0 Or $i_Base > $last Then $i_Base = 0
; Open output file for overwrite by default, or use input file handle if passed
Local $hFile
If IsString($File) Then
$hFile = FileOpen($File, $FO_OVERWRITE)
Else
$hFile = $File
EndIf
If $hFile = -1 Then Return SetError(1, 0, 0)
; Write array data to file
Local $ErrorSav = 0
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 $s_Temp
For $x = $i_Base To $i_UBound
$s_Temp = $a_Array[$x][0]
For $y = 0 To $iDims-1 ; было For $y = 1 To $iDims
$s_Temp &= $s_Delim & $a_Array[$x][$y]
Next
If FileWrite($hFile, $s_Temp & @CRLF) = 0 Then
$ErrorSav = 3
ExitLoop
EndIf
Next
EndSwitch
; Close file only if specified by a string path
If IsString($File) Then FileClose($hFile)
; Return results
If $ErrorSav Then Return SetError($ErrorSav, 0, 0)
Return 1
EndFunc ;==>_FileWriteFromArray