Newbie questions, text processing, for each etc.

Greg Zhang (starnet!apple!mprgate.mpr.ca!gzhang)
Tue, 29 Mar 94 11:09:30 PST

Hello, all!

I am very new to this Meta world. The beginner's guide to scripting,
the only doc I've got to work with, is not a lot of help. Here are some
newbie questions I have. Hopefully some of you old Meta scripting hands
can give me some good advise.

- '\n' at the end of line

My input gives me a sequence of items divided by new line character.

read from file|process <name> until numToChar(10)
put It into field <field_name>

keeps '\n' in <field_name>. How do I truncate '\n' out?

- How to do "for each card"?

Currently I am using:

go to card 1
put 0 into stop_card
repeat until number of this card is stop_card
<process>
put 1 into stop_card
go to next card
end repeat

This is clumsy and imperfect. Is there any neat(er) way to do it?

- Input from process

When I tried reading input from a process, after one or two reads,
it tells me the process no longer exist. Is this common or peculiar to
the way I start my process? BTW, I am reading input from a remote
machine using 'rcmd'/'rsh'. Maybe I should try reading from a local
process.

- Text processing

I've read from some posts that to do text processing, you first read
a whole bunch of text into a variable, then read from the variable chunk
by chunk to do your processing. I am not clear how this is accomplished.
How do you read from a variable? It appears to me that the only string
functions in Metacard/HyperCard are is and contains. These two are far
less than enough to do any real string manipulation.

OK, I hope I have not bored you and my questions actually make
sense.

Greg