Jump to content
Macro Express Forums

Reading Text Files


Recommended Posts

Here's the situation, I have a text file with about 1000 different serial numbers for parts. I need to find a way to have the macro get a value from the text file, output that value on the screen, then move to the next value in the text file. The serial numbers are on seperate lines in the text file. Is there anyway macro can do this? The closest thing I could find in macro was an option that allowed me to save the WHOLE text file to a variable and not one record from the text file. Any help would be greatly appreciated.

Link to comment
Share on other sites

Hello boilerbdub!


You want to look at the Text File Begin Process if it is a plain text file, or the ASCII File Begin Process command if it is something like a comma delimited file.


Both commands can process data in a text file a single line at a time.


Hope this helps!

Link to comment
Share on other sites

Hello boilerdub,


I am doing something similar. It is quite possible. As Joe said, you can use Text File Begin Process to move through the text file line by line. So long as you don't need to move back to prior lines, it is not really too difficult. With a little work, you will be able to find the data you want and display it with most of your commands being between the Text File Begin Process command and the Text File End Process command. Good luck with your effort.


Les Hazlett

Link to comment
Share on other sites

Yes, I tried the File Read Begin Process and for some reason it saved the whole text file to the variable that it created. The lines in my text file are seperated by line breaks, and I tried seperating them with commas and it did the same thing. It just tried to save the whole file to one variable. Am I doing something wrong?

Link to comment
Share on other sites

  • 3 weeks later...

if this is the beginning of your attached file (saved as a plain text file) :




this small macro reads records and displays them one by one ...


Text File Begin Process: "H8_CLASS4_PARTS_REPORT_TXT.txt"
 Pause: Complex
Text File End Process


text file begin process : start processing record=1, variable to receive text line=T1

pause : message=%T1%


I can't figure any problem in this ? but maybe I did not understood your problem ...

Link to comment
Share on other sites

I had to do something similar as well...


what I had to do is to use the ASCII File Begin Process "T1% (Tab Delimited Text) or whatever, then essentially saved the text out into a dump file.


T1 was the dump file name.


Ensure to click the Variable to Receive First Field, and it will start to process all your text files and put them into T2 - T99.


The downfall of this system, is that since Macex only has 99 variables, you only have that many spots.

Link to comment
Share on other sites

  • 2 years later...

I am trying to get T1 thorugh T99 filled, by reading a file, line by line.


BUT, I can only get T1 to fill, each line stores itself to T1. I can't gbet it to fill sequential variables.


It is just an ascii text file; each line separated by CR/LF




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...