Search the Community
Showing results for tags 'edit text file'.
-
Hi i start with new script to ad computer names to empty text file. The steps to do this are: Press Button "New CP Name List". Script check if cpnamelist.txt exist and delete it. Script create a new one. Now Script open cpnamelist.txt with notepad and i paste computer names in to this file and save file. How can i stop script until content is saved. I have tried Miscellaneous (winwait etc.) but somthing was wrong. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("CP Name List", 615, 438, 522, 356) $ListCPNameList = GUICtrlCreateList("", 25, 25, 96, 383) $ButtonNewCPNameList = GUICtrlCreateButton("New CP Name List", 130, 120, 105, 25) $ButtonAddCPName = GUICtrlCreateButton("Add CP Name", 130, 30, 105, 25) $ButtonRemoveCPName = GUICtrlCreateButton("Remove CP Name", 130, 60, 105, 25) $InputCPName = GUICtrlCreateInput("", 245, 30, 121, 21) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select ;Case $GUI_EVENT_CLOSE Case $msg = $GUI_EVENT_CLOSE Exitloop Case $msg = $ButtonNewCPNameList MsgBox(0, "Note", "$ButtonNewCPNameList") $CPnameList="D:\AutoIT_Scripts\writefile\temp\temp\cpnamelist.txt" If FileExists($CPnameList) Then FileDelete($CPnameList) ; CPNameList if exist. $hFile = FileOpen("D:\AutoIT_Scripts\writefile\temp\cpnamelist.txt", 1) FileClose($hFile) $sText = FileRead("D:\AutoIT_Scripts\writefile\temp\cpnamelist.txt", 1) $sText = StringReplace($sText, @CRLF, '|') $sText = StringReplace($sText, '||', '|') GUICtrlSetData($ListCPNameList, $sText) Case $msg = $ButtonAddCPName MsgBox(0, "Note", "$ButtonAddCPName") Case $msg = $ButtonRemoveCPName MsgBox(0, "Note", "$ButtonRemoveCPName") EndSelect WEnd func terminate() ;exit Exit 0 EndFunc