mafioso Posted January 19, 2007 Share Posted January 19, 2007 I need help to finish Save & Load functions...can somebody help me, please ? Save will read the listview and save it like .ini file, and load should read .ini file and modify listview... expandcollapse popupGlobal $YC Global $XC Global $Name #include <GUIListView.au3> #include <GUIConstants.au3> Global $CoordListItem[101] #Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\SciTE\Koda\Forms\save.kxf $Form1 = GUICreate("coords", 219, 300, 193, 115) $XC = GUICtrlCreateInput("", 40, 216, 33, 21) $Label1 = GUICtrlCreateLabel("X", 24, 216, 12, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Y", 80, 216, 13, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $YC = GUICtrlCreateInput("", 96, 216, 33, 21) $Enter = GUICtrlCreateButton("Enter", 136, 216, 59, 25, 0) $CoordList = GUICtrlCreateListView("#|X|Y", 24, 40, 171, 163, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_BORDER)) For $i = 1 To UBound($CoordListItem)-1 $CoordListItem[$i] = GUICtrlCreateListViewItem($i & "||",$CoordList) Next $Save = GUICtrlCreateButton("Save", 16, 256, 59, 25, 0) $Load = GUICtrlCreateButton("Load", 88, 256, 51, 25, 0) $OK = GUICtrlCreateButton("OK", 152, 256, 51, 25, 0) $WalkToName = GUICtrlCreateInput("", 24, 8, 169, 21) _GUICtrlListViewSetColumnWidth ($CoordList, 1, 60) _GUICtrlListViewSetColumnWidth ($CoordList, 2, 60) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CoordList Case $Enter If GUICtrlRead($XC) = "" Or GUICtrlRead($YC) = "" Then MsgBox(0,"Error","Fill In X & Y Inputs Please") Else GUICtrlSetData($CoordListItem[_GUICtrlListViewGetSelectedIndices($CoordList)+1],_GUICtrlListViewGetSelectedIndices($CoordList)+1 & "|" & GUICtrlRead($XC) & "|" & GUICtrlRead($YC)) EndIf Case $OK $Name = GUICtrlRead($WalkToName) If $Name = "" Then MsgBox(64,"Error", "You must have a path loaded or it wont work") Else $X1 = _GUICtrlListViewGetItemText ($CoordList, 1,1) $Y1 = _GUICtrlListViewGetItemText ($CoordList, 1,2) MsgBox(64,"faf", "You are using the walkback path named : " & $Name) GUISetState(@SW_HIDE) EndIf Case $Save $Name = GUICtrlRead($WalkToName) If $Name = "" Then $Name = "Untitled" EndIf FileDelete(@ScriptDir & "\Paths\" & $Name) $CoordsList = GUICtrlRead($CoordListItem[1]) FileWriteLine(@ScriptDir & "\Paths\" & $Name,$CoordsList) $CoordsList = GUICtrlRead($CoordListItem[2]) DirCreate (@ScriptDir) ;~ Needs to be finished Case $Load $Name = GUICtrlRead($WalkToName) If $Name = "" Then MsgBox(64,"Error", "Enter a name up top") EndIf ;~ Needs to be finished $line = FileReadLine(@ScriptDir & "\Paths\" & $Name,1) GUICtrlSetData($CoordListItem[1],$line) $line = FileReadLine(@ScriptDir & "\Paths\" & $Name,2) GUICtrlSetData($CoordListItem[2],$line) ;~ Needs to be finished EndSwitch Link to comment Share on other sites More sharing options...
autosc Posted January 19, 2007 Share Posted January 19, 2007 I need help to finish Save & Load functions...can somebody help me, please ? Save will read the listview and save it like .ini file, and load should read .ini file and modify listview... expandcollapse popupGlobal $YC Global $XC Global $Name #include <GUIListView.au3> #include <GUIConstants.au3> Global $CoordListItem[101] #Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\SciTE\Koda\Forms\save.kxf $Form1 = GUICreate("coords", 219, 300, 193, 115) $XC = GUICtrlCreateInput("", 40, 216, 33, 21) $Label1 = GUICtrlCreateLabel("X", 24, 216, 12, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Y", 80, 216, 13, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $YC = GUICtrlCreateInput("", 96, 216, 33, 21) $Enter = GUICtrlCreateButton("Enter", 136, 216, 59, 25, 0) $CoordList = GUICtrlCreateListView("#|X|Y", 24, 40, 171, 163, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_BORDER)) For $i = 1 To UBound($CoordListItem)-1 $CoordListItem[$i] = GUICtrlCreateListViewItem($i & "||",$CoordList) Next $Save = GUICtrlCreateButton("Save", 16, 256, 59, 25, 0) $Load = GUICtrlCreateButton("Load", 88, 256, 51, 25, 0) $OK = GUICtrlCreateButton("OK", 152, 256, 51, 25, 0) $WalkToName = GUICtrlCreateInput("", 24, 8, 169, 21) _GUICtrlListViewSetColumnWidth ($CoordList, 1, 60) _GUICtrlListViewSetColumnWidth ($CoordList, 2, 60) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CoordList Case $Enter If GUICtrlRead($XC) = "" Or GUICtrlRead($YC) = "" Then MsgBox(0,"Error","Fill In X & Y Inputs Please") Else GUICtrlSetData($CoordListItem[_GUICtrlListViewGetSelectedIndices($CoordList)+1],_GUICtrlListViewGetSelectedIndices($CoordList)+1 & "|" & GUICtrlRead($XC) & "|" & GUICtrlRead($YC)) EndIf Case $OK $Name = GUICtrlRead($WalkToName) If $Name = "" Then MsgBox(64,"Error", "You must have a path loaded or it wont work") Else $X1 = _GUICtrlListViewGetItemText ($CoordList, 1,1) $Y1 = _GUICtrlListViewGetItemText ($CoordList, 1,2) MsgBox(64,"faf", "You are using the walkback path named : " & $Name) GUISetState(@SW_HIDE) EndIf Case $Save $Name = GUICtrlRead($WalkToName) If $Name = "" Then $Name = "Untitled" EndIf FileDelete(@ScriptDir & "\Paths\" & $Name) $CoordsList = GUICtrlRead($CoordListItem[1]) FileWriteLine(@ScriptDir & "\Paths\" & $Name,$CoordsList) $CoordsList = GUICtrlRead($CoordListItem[2]) DirCreate (@ScriptDir) ;~ Needs to be finished Case $Load $Name = GUICtrlRead($WalkToName) If $Name = "" Then MsgBox(64,"Error", "Enter a name up top") EndIf ;~ Needs to be finished $line = FileReadLine(@ScriptDir & "\Paths\" & $Name,1) GUICtrlSetData($CoordListItem[1],$line) $line = FileReadLine(@ScriptDir & "\Paths\" & $Name,2) GUICtrlSetData($CoordListItem[2],$line) ;~ Needs to be finished EndSwitch GuiList Management >>> help file Link to comment Share on other sites More sharing options...
BrettF Posted January 19, 2007 Share Posted January 19, 2007 Try using the following functions: _FileWriteFromArray _FileReadToArray _GUICtrlListViewInsertItem Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now