This is one of the most unusual things I have come across. I have a text file that displays correclty in notepad and I want to parse it out, but I get strange results. I can open a new copy of notepad, copy and paste the text, save it with a different file name and then it will work.
So, thinking quickly I though I would read each line and rewrite the file – that didn’t work.
When I read the file the first line show it shows “LINEA=ÿþâ€Â
Parseing Text file issue it displays correctly in Note Pad
Moderators: JRL, Dorian (MJT support)
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
It's clunky, but I think the quickest way without finding and installing other software would be to open the file in Notepad, and then save it being sure the ANSI option is selected in the Encoding box (tab to that box and send A). I don't have time now to code that but it shouldn't be any problem for someone of your experience
There may be some vbscript trick too...

There may be some vbscript trick too...
Any method I can think of outside of using notepad will require you to evaluate every single character and compare it to a list of acceptable characters. NotePad will do that for you pretty much effortlessly and fast.
I'm sure you want the process to look clean. Try opening the file in notepad using Run Program>notepad filename with RP_WINDOWMODE set to 0. Then use WaitWindowOpen>Notepad* and the next line will be MoveWindow>Notepad*,-10000,-10000. This gets the work off screen and avoids the "clunky" look. Then work with the Notepad window using keystroke inputs. Get the text into the clipboard using Ctrl+A and Ctrl+C the rest should be easy. Close Notepad then use GetClipboard>file to put the file into the script. Then if you use Separate>file,%CRLF%,line you have every line captured as a variable named "line_x" where the "x" is the line number.
If you need more I can put together a sample sometime tomorrow.
Other ideas are welcome.
I'm sure you want the process to look clean. Try opening the file in notepad using Run Program>notepad filename with RP_WINDOWMODE set to 0. Then use WaitWindowOpen>Notepad* and the next line will be MoveWindow>Notepad*,-10000,-10000. This gets the work off screen and avoids the "clunky" look. Then work with the Notepad window using keystroke inputs. Get the text into the clipboard using Ctrl+A and Ctrl+C the rest should be easy. Close Notepad then use GetClipboard>file to put the file into the script. Then if you use Separate>file,%CRLF%,line you have every line captured as a variable named "line_x" where the "x" is the line number.
If you need more I can put together a sample sometime tomorrow.
Other ideas are welcome.
Flashing Screen
Thank you, I used the following to make it work - I hate it when people don't post what they actually did.
DeleteFile>c:\consolegrab\clean.txt
Let> RP_WINDOWMODE=0
Run Program>notepad c:\consolegrab\output.txt
WaitWindowOpen>Notepad*
MoveWindow>Notepad*,-1000,-1000
SetFocus>Notepad*
Press Ctrl
Send>a
Release Ctrl
Press Ctrl
Send>c
Release Ctrl
GetClipBoard>cleantxt
WriteLn>c:\consolegrab\clean.txt,result,%cleantxt%
I wrote the file to text instead of taking your advice. As what this script is going to do is allow a user to highlight text, find the position, and write the line number, start and end postion to a text file. It will repeat it as many times as the user wants. Once this is done, another script will process the output file from this one allowing a user to parse as much data as they want.
However, when I run the script the screen flashes, very briefly, any ideas on to prevent this?
DeleteFile>c:\consolegrab\clean.txt
Let> RP_WINDOWMODE=0
Run Program>notepad c:\consolegrab\output.txt
WaitWindowOpen>Notepad*
MoveWindow>Notepad*,-1000,-1000
SetFocus>Notepad*
Press Ctrl
Send>a
Release Ctrl
Press Ctrl
Send>c
Release Ctrl
GetClipBoard>cleantxt
WriteLn>c:\consolegrab\clean.txt,result,%cleantxt%
I wrote the file to text instead of taking your advice. As what this script is going to do is allow a user to highlight text, find the position, and write the line number, start and end postion to a text file. It will repeat it as many times as the user wants. Once this is done, another script will process the output file from this one allowing a user to parse as much data as they want.
However, when I run the script the screen flashes, very briefly, any ideas on to prevent this?
I don't see a blip on my LCD monitor. Probably slow response timeHowever, when I run the script the screen flashes, very briefly, any ideas on to prevent this?

I was looking at your posted code and assumed you wanted to deal with individual lines.I wrote the file to text instead of taking your advice.
Yes, without feedback its hard to feel good about helping. And there's really only two reasons for one forum member to help another forum member. The first is learning and the second is to feel good about helping.I hate it when people don't post what they actually did.
One more thing, you need a line to close notepad otherwise you'll end up with stranded notepad sessions.
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Re: Flashing Screen
Yep, agreed, that's frustrating...kpassaur wrote:I hate it when people don't post what they actually did.