Arclite86

how to put a characher after every line in a txt file (easy)

5 posts in this topic

i have a autoit program that opens a txt file

Global $iIndex = 0, $sListData1 = "C:\Users\user pc\Desktop\mapa\lijsten\list1.txt"
Global $sListFile1 = "C:\Users\user pc\Desktop\mapa\lijsten\list1.txt"



If FileExists($sListFile1) Then
    $sListData1 = FileRead($sListFile1)
EndIf


GUICtrlSetData($List1, $sListData1)
_GUICtrlListBox_SetCurSel($List1, $iIndex)

the only problem is when I open the txt file there is no "|" charachter between the words so it only shows  a very long one word.

Share this post


Link to post
Share on other sites



Can you provide an example of what is in list1.txt?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Can you provide an example of what is in list1.txt?

A bunch of names for my administration like:

HelmerTilmans
MozesSchrijver
MelwinWilschut
PercyvanZwien
RoelfFolkersma
MarcelodeKeizer
EvanderPiet
JanvanKlavere
AadHorsthuis
EwoutRosenboom
RudiLebens
Dimitrioszwaag
Matejvanderziel
etc..

and this is what i would like to have it

HelmerTilmans|
MozesSchrijver|
MelwinWilschut|
PercyvanZwien|
RoelfFolkersma|
MarcelodeKeizer|
EvanderPiet|
JanvanKlavere|
AadHorsthuis|
EwoutRosenbom|
RudiLebens|
Dimitrioszwaag|
Matejvanderziel|
etc..

or before every name

Share this post


Link to post
Share on other sites
$sFile = fileread("test.txt")
$sRepl = StringReplace($sFile , @CRLF , "|" & @CRLF)
filewrite("output.txt" , $sRepl)

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Global $iIndex = 0, $sListData1 = "C:\Users\user pc\Desktop\mapa\lijsten\list1.txt"
Global $sListFile1 = "C:\Users\user pc\Desktop\mapa\lijsten\list1.txt"

If FileExists($sListFile1) Then
    $sListData1 = StringReplace(FileRead($sListFile1), @CRLF, "|")
EndIf

GUICtrlSetData($List1, $sListData1)
_GUICtrlListBox_SetCurSel($List1, $iIndex)

 

Edited by ViciousXUSMC

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now