Ive tried to make a line add mini macro
0122/12Firstone
Empty line here
What it does?
Well, i just click ADD, see what happens
0122/12Firstone
0124/12Second
Empty line here
But empty line continue
How to rid out of this?
How to remove last blank line on a file
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
As we can't see your code we don't know how this file is being produced and why the blank line is there. We can give you code to remove a blank line from the end of a file, but wouldn't it be better if we could prevent the blank line from being output in the first place? We may be able to have a stab at that if we knew how the file was being created.
Anyhow, this code will remove a blank line from the end of a file:
Let>file=%SCRIPT_DIR%\test2.txt
ReadFile>file,filedata
Trim>filedata,filedata
DeleteFile>file
WriteLn>file,wlr,filedata
All it does is read the file in, trim the content, delete the original file and write it out again.
But, as I said, maybe we should look at how this blank line is winding up there in the first place and look to prevent that happening.
Anyhow, this code will remove a blank line from the end of a file:
Let>file=%SCRIPT_DIR%\test2.txt
ReadFile>file,filedata
Trim>filedata,filedata
DeleteFile>file
WriteLn>file,wlr,filedata
All it does is read the file in, trim the content, delete the original file and write it out again.
But, as I said, maybe we should look at how this blank line is winding up there in the first place and look to prevent that happening.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?