请教关于返回的数组值写入ini文件的格式问题“已解决”
本帖最后由 nuoyan 于 2021-9-17 13:04 编辑#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <array.au3>
#include <File.au3>
#include <Array.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 220, 395)
$ListView1 = GUICtrlCreateListView("row", 30, 20, 156, 326)
$ListView1_0 = GUICtrlCreateListViewItem("a", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("b", $ListView1)
$ListView1_2 = GUICtrlCreateListViewItem("c", $ListView1)
$ListView1_3 = GUICtrlCreateListViewItem("d", $ListView1)
$ListView1_4 = GUICtrlCreateListViewItem("e", $ListView1)
$Button1 = GUICtrlCreateButton("确定", 70, 355, 65, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Local $aArray
For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
Local $aItem = _GUICtrlListView_GetItemTextArray($ListView1, $i)
For $j = 1 To UBound($aItem) - 1
$aArray[$i][$j - 1] = $aItem[$j]
Next
Next
IniWrite(@ScriptDir & "\111.ini", "111", "222", _ArrayToString($aArray, "", 0, UBound($aArray) - 1))
EndSwitch
WEnd
请教下如何将写入到ini文件的格式变成以下效果:
222=a,b,c,d,e
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Local $sComboTxt = ""
Local $aArray
For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
Local $aItem = _GUICtrlListView_GetItemTextArray($ListView1, $i)
For $j = 1 To UBound($aItem) - 1
$aArray[$i][$j - 1] = $aItem[$j]
$A = $aItem[$j]
If Not StringInStr($sComboTxt, $A) Then $sComboTxt &= $A & "," ;&@CRLF;"|"
Next
Next
Local $sString = StringTrimRight($sComboTxt, 1)
IniWrite(@ScriptDir & "\111.ini", "111", "222", $sString)
EndSwitch
WEnd chzj589 发表于 2021-9-17 12:49
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
非常感谢大佬的热心帮助。谢谢。谢谢
页:
[1]