MvGulik Posted December 14, 2010 Posted December 14, 2010 shanet It looks to me your trying to use a single character as a delimiter in two different data parts. - Event string: when stored in a file -> using @CR+@LF as line(DATA SECTION) delimiter. - Description string (sub part of Event data): can contain its own line-break(text formating) delimiters. assuming @CR or @CRLF To solve something like that you need to add some way to make is possible to keep them apart. Your Options: - using a different (unique) character for one of the two delimiters. (see one of my earlier messages.) - using a special character that indicated that the next character is to be taken as something special. ('\r' and '\n' method) - adding additional delimiters to mark a change in data state. Like adding quote marks around text that can include true line-break characters. (Search for CSV specs for additional information/example on this method) "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
BrewManNH Posted December 14, 2010 Posted December 14, 2010 The problem with the code Ascend4nt posted is it writes to more than one line, which as I said above is not how I want it done, thats the reason behind this thread is to keep it on one line.Can you give an example of what you see with Acend4nt's code and an example of what you want it to look like? The larger the sample size the better understanding of what it is that you're looking for. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
shanet Posted December 15, 2010 Author Posted December 15, 2010 (edited) $txt=StringReplace($txt, @CRLF, '" & @CRLF & "' & @CRLF)EDIT: That didnt quite work how I wanted it to, so the text to pay attention to is now in bold. (NOT THIS TEXT!!!) As far as writing to the file goes, it works fine without the & @CRLF part highlighted here, however when I read the file, instead of line breaking, it shows the " & @CRLF & "For example, it the text written in the file was this:"Test Data" & @CRLF & "More test data"it would display"Test Data" & @CRLF & "More test data"instead of a line break. Ideally, it would be:Test DataMore test dataSo thats now what I am trying to do.shanet Edited December 15, 2010 by shanet [font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS: %programfiles%/AutoIt3/autoit3.chm
MvGulik Posted December 15, 2010 Posted December 15, 2010 ???, You lost me/Not getting it. I'm out. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
shanet Posted December 15, 2010 Author Posted December 15, 2010 (edited) ???, You lost me/Not getting it. I'm out. OK, Try this: Local $txt $txt = FileReadLine("log.log", 1) MsgBox(0, "", $txt) Then, create a file in the same directory called log.log, containing the data: Test Data" & @CRLF & "Line Two Ideally, this would bring up a message box displaying: Test Data Line Two However in practice, it actually displays: Test Data" & @CRLF & "Line Two I have tried variations such as: -"Test Data" & @CRLF & "Line Two" - Test Data & @CRLF & Line Two - Test Data@CRLFLine Two - Test Data" @CRLF " Line Two Does anyone know the solution to this? Is it still too confusing? Thanks, shanet Edited December 15, 2010 by shanet [font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS: %programfiles%/AutoIt3/autoit3.chm
Moderators Melba23 Posted December 15, 2010 Moderators Posted December 15, 2010 shanet,Enclose the whole thing in quotes and use Execute. Your file:"Test Data" & @CRLF & "Line Two"Your script:Local $txt $txt = FileReadLine("log.log", 1) MsgBox(0, "", Execute($txt))That gives me:Test Data line 2in the MsgBox. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
shanet Posted December 15, 2010 Author Posted December 15, 2010 shanet,Enclose the whole thing in quotes and use Execute. OMG!!! Im not gay but at the moment I LOVE YOU!!!!Just kidding. But THANKYOU!!!It works like a charm. 10 points!shanet [font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS: %programfiles%/AutoIt3/autoit3.chm
Moderators Melba23 Posted December 15, 2010 Moderators Posted December 15, 2010 shanet,I appreciate the sentiment, even if the expression left a little to be desired! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
BrewManNH Posted December 15, 2010 Posted December 15, 2010 The reason it worked is because you're not adding the macro @CRLF when you do the string replace, you're adding the text @CRLF. The Execute statement turns the string into a statement and then gives you the correct result that you're looking for. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
shanet Posted December 15, 2010 Author Posted December 15, 2010 The reason it worked is because you're not adding the macro @CRLF when you do the string replace, you're adding the text @CRLF. The Execute statement turns the string into a statement and then gives you the correct result that you're looking for.That's right I learned something really valuable today. [font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS: %programfiles%/AutoIt3/autoit3.chm
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