Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Append something entered to a file?

May
12,846
164
I have a long-running batch file which produces a log file. I can interrupt the batch file's main loop (by looking at keystrokes) and do administrative things (set parameters with ESET, get status info, et c.) then continue. I'd like to add the ability to put a hand-written notation in the log file.

So how do I get TCC to accept text from the keyboard and when I'm done (Enter or Ctrl-Z?) write it to a file? [This seems like an ancient technique which I have simply forgotten.]
 
---- Original Message ----
From: vefatica
To: [email protected]
Sent: Monday, 2011. February 28. 23:02
Subject: [Support-t-2639] Append something entered to a file?

| I have a long-running batch file which produces a log file. I can
| interrupt the batch file's main loop (by looking at keystrokes) and
| do administrative things (set parameters with ESET, get status info,
| et c.) then continue. I'd like to add the ability to put a
| hand-written notation in the log file.
|
| So how do I get TCC to accept text from the keyboard and when I'm
| done (Enter or Ctrl-Z?) write it to a file? [This seems like an
| ancient technique which I have simply forgotten.]

INPUT?
--
Steve
 

That's not exactly whan I was thinking (ESET could be used similarly). I may be wrong, but I seem to recall something like (paraphrasing)

Code:
< keyboard >> file  [press Ctrl-Z when done]
Am I thinking of UNIX?
 
On Mon, 28 Feb 2011 23:44:00 -0500, TEA-Time <> wrote:

|Code:
|---------
|< keyboard >> file [press Ctrl-Z when done]
|---------
|Am I thinking of UNIX?
|---End Quote---
|COPY CON?

That may be what I was thinking of. Can it append to the file?
 
> -----Original Message-----
> From: vefatica
> Sent: Tuesday, 1 March 2011 5:03 p.m.
> Subject: [Support-t-2639] Append something entered to a file?
>
> I have a long-running batch file which produces a log file. I can
> interrupt the batch file's main loop (by looking at keystrokes) and
> do administrative things (set parameters with ESET, get status info,
> et c.) then continue. I'd like to add the ability to put a
> hand-written notation in the log file.
>
> So how do I get TCC to accept text from the keyboard and when I'm
> done (Enter or Ctrl-Z?) write it to a file? [This seems like an
> ancient technique which I have simply forgotten.]

@fileopen[]
querybox %%stuff
@fileclose[]
 
-----Original Message-----
From: Kach [mailto:[email protected]]
Sent: Tuesday, 1 March 2011 7:05 p.m.
To: Kach
Subject: RE: [Support-t-2639] Append something entered to a file?


forgot to write that stuff ......lol


> -----Original Message-----
> From: Kach [mailto:[email protected]]
> Sent: Tuesday, 1 March 2011 6:54 p.m.
> To:
> Subject: RE: [Support-t-2639] Append something entered to a file?
>
>
> > -----Original Message-----
> > From: vefatica
> > Sent: Tuesday, 1 March 2011 5:03 p.m.
> > Subject: [Support-t-2639] Append something entered to a file?
> >
> > I have a long-running batch file which produces a log file. I can
> > interrupt the batch file's main loop (by looking at keystrokes) and
> > do administrative things (set parameters with ESET, get status info,
> > et c.) then continue. I'd like to add the ability to put a
> > hand-written notation in the log file.
> >
> > So how do I get TCC to accept text from the keyboard and when I'm
> > done (Enter or Ctrl-Z?) write it to a file? [This seems like an
> > ancient technique which I have simply forgotten.]
>

set open_0=%@fileopen[%@unique[],w,t]
querybox /e %%stuff
set w=%@filewrite[%open_0,%stuff]
echo %@fileclose[%open_0]
 
On Mon, 28 Feb 2011 23:44:00 -0500, TEA-Time <> wrote:

|Code:
|---------
|< keyboard >> file [press Ctrl-Z when done]
|---------
|Am I thinking of UNIX?
|---End Quote---
|COPY CON?

That may be what I was thinking of. Can it append to the file?
Good question... I guess it does. See the Appending Files section in COPY's help.

COPY test.txt+CON

..appends what's entered to an existing test.txt.
 
On Tue, 01 Mar 2011 01:13:36 -0500, TEA-Time <> wrote:

|That may be what I was thinking of. Can it append to the file?
|---End Quote---
|Good question... I guess it does. See the Appending Files section in COPY's help.
|
|COPY test.txt+CON
|
|..appends what's entered to an existing test.txt.

Thanks! That seems arcane/obscure but it does what I want. The problem with
INPUT/ESET is that later, you's have to ECHO the variable to a file and any
special characters would cause big problems.

Another question: You end "COPY test.txt+CON" with Ctrl-Z. Is there a way to
prevent the Ctrl-Z from winding up in the file (another way to terminate the
input)? I haven't considered it in about 20 years, but today, putting Ctrl-Z in
a file seems very odd (especially if **any** software is later going to consider
it EOF).
 
It depends on how things are added to the file by the batches.

Ye should use the same method, eg echo 'text' >> logfile

You could set a subroutine 'note' that simply takes text from the command line, and add it to the file.
 
I can't login to the forum site. I enter my userid/password and the same login
dialog returns.

- Vince
 

Similar threads

Back
Top