Giggo Posted February 3, 2022 Share Posted February 3, 2022 Hello comunity! i can't see the text of list in inputbox code is: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("show list", 380, 350, 199, 410) $i_inp1 = GUICtrlCreateInput("", 14, 10, 350, 250) $b_save = GUICtrlCreateButton("Save", 16, 290, 120, 30) $b_show = GUICtrlCreateButton("Show File .txt", 147, 290, 120, 30) Local $sFilePath = @ScriptDir & '\list.txt' GUISetState(@SW_SHOW) While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $b_show $i_Gread = GUICtrlRead($sFilePath ) Case $b_save FileDelete("list.txt") $i_Gread = GUICtrlRead($i_inp1) If $i_Gread <> "" Then $sFilePath = FileOpen(@ScriptDir & '\list.txt', 128+1) FileWrite($sFilePath, $i_Gread & @CR) FileWrite($sFilePath, "" & @CRLF) FileClose($sFilePath) EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
Musashi Posted February 3, 2022 Share Posted February 3, 2022 (edited) Try : <code removed> EDIT : @Giggo : Here is a better version : expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("show list", 380, 350, 199, 410) $i_inp1 = GUICtrlCreateInput("", 14, 10, 350, 250) $b_save = GUICtrlCreateButton("Save", 16, 290, 120, 30) $b_show = GUICtrlCreateButton("Show File .txt", 147, 290, 120, 30) Local $sFilePath = @ScriptDir & '\list.txt' Local $hFileOpen, $sDataRead, $sDataWrite GUISetState(@SW_SHOW) While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $b_show $sDataRead = FileRead($sFilePath) If @error Then MsgBox(BitOr(4096,16), "Error : ", $sFilePath & @CRLF & @CRLF & _ "File not found or empty" & @CRLF) Else GUICtrlSetData($i_inp1, $sDataRead) EndIf Case $b_save FileDelete($sFilePath) $sDataWrite = GUICtrlRead($i_inp1) If $sDataWrite <> "" Then $hFileOpen = FileOpen($sFilePath, 128 + 1) FileWrite($hFileOpen, $sDataWrite & @CR) FileWrite($hFileOpen, "" & @CRLF) FileClose($hFileOpen) EndIf EndSwitch WEnd Edited February 3, 2022 by Musashi Giggo 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Giggo Posted February 3, 2022 Author Share Posted February 3, 2022 Thanks Musashi perfect working 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