magace Posted August 21, 2013 Share Posted August 21, 2013 I am trying to figure out how to make the FileWriteLine write to the same line until I hit a button forcing it to go to the next line. Any ideas? Here is a rough gui with buttons to help understand what I am trying to do. Thanks! expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() Local $Button_1, $Button_2, $msg GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered Opt("GUICoordMode", 2) $Button_1 = GUICtrlCreateButton("log 1", 10, 30, 100) $Button_2 = GUICtrlCreateButton("log 2", 0, -1) $Button_3 = GUICtrlCreateButton("newline 1", 0, -1) $Button_4 = GUICtrlCreateButton("newline 2", 0, -1) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Local $file = FileOpen("button1.txt", 1) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, "1") ;;help write to same line here;;;;;; FileClose($file) Case $msg = $Button_2 Local $file = FileOpen("button2.txt", 1) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, "2") ;;help write to same line here;;;;;; FileClose($file) Case $msg = $Button_3 Local $file = FileOpen("button1.txt", 1) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ;;help create new line here;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $msg = $Button_4 Local $file = FileOpen("button2.txt", 1) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ;;help create new line here;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FileClose($file) EndSelect WEnd EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted August 21, 2013 Developers Share Posted August 21, 2013 FileWriteLine implies you are writing a line/record each time. Use FileWrite() when you want to write information to a file without the CRLF. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
magace Posted August 21, 2013 Author Share Posted August 21, 2013 lol thanks >< Link to comment Share on other sites More sharing options...
magace Posted August 21, 2013 Author Share Posted August 21, 2013 How about going to a new line after like 50 characters are on a line? Link to comment Share on other sites More sharing options...
NewPlaza Posted August 21, 2013 Share Posted August 21, 2013 FileWriteLine($file, "") or FileWriteLine($file, @CRLF) Link to comment Share on other sites More sharing options...
Developers Jos Posted August 21, 2013 Developers Share Posted August 21, 2013 How about going to a new line after like 50 characters are on a line? Keep count on how many characters you have written and write the @CRLF when you hit 50 characters. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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