[comp.sys.mac.hypercard] Need help with formatting text into columns

jlc@atux01.UUCP (J. Collymore) (06/23/89)

I REALLY need to find a way to format data into a COLUMNS that will be printed
out as a file.

Basically what I'm doing is having HyperCard (HC) go through a background's
fields and get a specific line of a specified field.  I then have the line
sent (and added to) a variable.  Once all the fields of the background have been
scanned, I then open a file, send the contents of the variable to the file,
close the file, and then have the file printed.  The problem is is that what I
get printed out is something like this:

This is line 1
This is line 1
This is line 1
This is line 1...etc.

What I'd LIKE to get is:

This is line 1	This is line 1	This is line 1	This is line 1
This is line 1	This is line 1	This is line 1	This is line 1
This is line 1	THis is line 1 ... etc.

Does ANYONE out there know how this can be done?  I've tried a lot of script
variations, and none of them quite works.  OH!  I should add that the lines
of text that need to be set into columns will NOT be of equal length.
THerefore, I really want to make 3 columns and have the text left justified
within each column.

Do any of you have any scripting siggestions to accomplish this.
I'd appreciate ANY suggestions.

Thanks for your help.


						Jim Collymore

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (06/24/89)

In article <1339@atux01.UUCP> jlc@atux01.UUCP (J. Collymore) writes:
>I REALLY need to find a way to format data into a COLUMNS that will be
>printed out as a file.
>[ . . . ]
>What I'd LIKE to get is:
>
>This is line 1	This is line 1	This is line 1	This is line 1
>This is line 1	This is line 1	This is line 1	This is line 1
>This is line 1	THis is line 1 ... etc.
>[ . . . ]
>THerefore, I really want to make 3 columns and have the text left justified
>within each column.

It depends on what sort of file you're exporting to. If it's a word-processor
file, the solution may be rather simple: put tabs between the columns.

on getMyData
  repeat with x = 1 to the number of cards
    put field 1 & tab & field 2 & tab & field 3 into line x of myVar
  end repeat
  open file "foo"
  write myVar to file "foo"
  close file "foo"
  print "foo" with "My Word Processor"
end getData

Something like that. This will work if the destination program (word processor,
database, etc) recognizes tabs and will set them up for you in a new file.

====== jeanne a. e. devoto =================================================
 Usenet: jdevoto@apple.com  |  You may not distribute this article under a
         jdevoto@well.UUCP  |  compilation copyright without my permission.