Problem with fileread
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Problem with fileread
Suddenly fileread is not inserting linefeeds unless I use the option *t which help says should be unnecessary. . What could be causing this change in behaviour? I'm only trying to read text files. Thanks.
Edit: I checked two different text files using notepad++ to see the hidden cr and lf characters. Both have the same structure yet fileread is treating the files differently. One is loaded as a single string and the other with linefeeds as expected. This is worrying.
Edit: I checked two different text files using notepad++ to see the hidden cr and lf characters. Both have the same structure yet fileread is treating the files differently. One is loaded as a single string and the other with linefeeds as expected. This is worrying.
Re: Problem with fileread
maybe try with fileopen
Code: Select all
F1 := a_desktop . "\test1.txt"
F2 := a_desktop . "\test2.txt"
aa := FileOpen(F1,"r",UTF-8)
var:= aa.Read()
aa.Close()
FileOpen(F2, "w", "UTF-8").Write(var)
try
run,%f2%
exitapp
;=========================================
Re: Problem with fileread
u can post the files and the code, then we can see if something is actually wrong
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: Problem with fileread
Thanks for the replies. Sample code:
With the attached file the first msgbox has no linefeeds resulting in a long string while the second does.
Code: Select all
fileread, update, #[settings].txt
msgbox, 4096, update,% update
fileread, update, *t #[settings].txt
msgbox, 4096, update,% update
- Attachments
-
- #[settings].txt
- (210 Bytes) Downloaded 13 times
Re: Problem with fileread
The MsgBoxes look identical here.
Re: Problem with fileread
the file contains 2 instances of CRLF in it(yielding 3 lines total)
the first msgbox shows
the second msgbox shows
both MsgBoxes show the same 3 lines. FileRead *t has correctly translated CRLF into LF
ahk 1.1.32.02, all exes
the first msgbox shows
the second msgbox shows
both MsgBoxes show the same 3 lines. FileRead *t has correctly translated CRLF into LF
ahk 1.1.32.02, all exes
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: Problem with fileread
Thanks for the replies. On my system I'm only getting three lines with fileread and that file when I use *t. I get a long string when I don't. Could reinstalling AutoHotKey fix this issue? Thanks again.
Re: Problem with fileread
You can try sending screenshot of the msgbox.
Im curious what do you mean by different
I tried your script with your own txt file, same result. Maybe your AHK version? Are you using the newest V1?
Im curious what do you mean by different
I tried your script with your own txt file, same result. Maybe your AHK version? Are you using the newest V1?
My Creations
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
ControlProcess
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key