Jump to content
Macro Express Forums

Ascii File Begin Process: Managing Text Files Help


klutzo

Recommended Posts

Hello there,

 

Been a Mac Ex user for about a year and a half now.. Love the program, it sure helps automation out at work.

 

Question, have any of you used the ASCII File Begin Process commands under 'Files/Folders'?

 

I have been trying to get this to run as a TAB delim file with their examples, and cannot seem to work it out.

 

i.e.

 

MC<tab>98 SE, 2000<tab><tab>Athlon<tab>750 MHz<tab>256 M<tab><tab>83<enter>

JH<tab>95 B<tab>5.00.3314.2101<tab>P II<tab>333 MHz<tab>65 M<enter>

KH<tab>98 SE, 2000<tab>5.00.3314.2101<tab>P III<tab>550 MHz<tab>384 M<tab><tab><tab>17" Flat

KG<tab>XP<tab>5.50.4807.2300<tab>P 4<tab>1.7 GHz<tab>256 M<tab><tab><tab>17" Flat, 15" LCD

SJ<tab>98 SE<tab><tab>Athlon<tab>900 MHz<tab>128 M<tab><tab><tab>17"

 

Any suggestions?

Link to comment
Share on other sites

Hi Klutzo.

 

A few pointers for using ASCII File Processing......

 

* For Every ASCII File Begin Process command, you need an ASCII File End Process command.

 

* These commands act like the Repeat Loop, and will process the input file ONE ROW AT A TIME (up to the CR/LF).

 

* If you state that the "Variable to Receive First Field" is T11, and you have 5 fields in the file, Then T11, T12, T13, T14, T15 will be populated with the strings in those fields. You need to perform any processing you require on those fields BETWEEN the Begin Process, and the End process commands.

 

* Try putting a TEXT BOX DISPLAY, with an OK button in between the BEGIN and END commands. Make the Box content T11=%T11%:T12=%T12% etc.

 

This will show you what is happening.

 

If you still have problems, attach the file here.

Good Luck

 

Pete.

Link to comment
Share on other sites

Hello,

 

The example in the help file uses the "<tab>" word to represent the invisible ASCII( 08 ). So, your test should not include the representation but the actual character.

 

MC<tab>98 SE, 2000<tab><tab>Athlon<tab>750 MHz<tab>256 M<tab><tab>83

 

I have attached a sample file.

TabDelimitedSample.zip

Link to comment
Share on other sites

Hmm.. and at the end of each record, a carriage return?

 

Essentially I have a pile of text files from a preset format, I have to load up the text file, then process it, save it out again into a format that MacEx likes. So I have to somehow add in the Tabs, and the CRs in a variable.

 

1) I load up the text file, and save the text as a variable

2) I have to process the tabs, and CRs I assume?

3) now I can work with it and break out the information into individual variables starting with %T50% up to %T80% for instance.

 

 

hope I'm making some sense.

Link to comment
Share on other sites

From what you say the file is not currently tab delimited, and does not have CRLFs?

 

If this is the case you will need to

 

1) I load up the text file, and save the text as a variable

 

2) I have to process the tabs, and CRs I assume?

(by that you mean insert the tabs? I would use commas - slightly easier)

 

2b) append each row to a temporary text file (you can add the CRLF as you do this).

 

Now you have a file you can work with (if you use commas it's in .CSV format).

 

3) now I can work with it and break out the information into individual variables starting with %T50% up to %T80% for instance.

 

===================================================

I have done this many times to parse the source of a web page, to convert a table in to a .csv file so that it can be imported to excel.

 

Pete.

Link to comment
Share on other sites

Ok.. just managed to get it.. I take the initial txt file, eliminated all CR and LFs, then manually added the TAB using Ascii code 9, and Ascii code 13 for CRs.

 

thanks a lot for the help.. I think all I needed was a little hint to jog my brain a bit.

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.

Guest
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.

Loading...
×
×
  • Create New...