Topic: Commandline input / output file buffers? (1 of 16), Read 24 times
Conf: VEDIT Macro Language Support
From: John H
Date: Tuesday, May 11, 2004 09:49 PM

Hi,
I'm writing a conversion macro that when run manually, is assigning
a couple numeric registers the buffer numbers for the source and
target data. The output file is then named based on the source file
name.

EG:

begin macro
..
#10 = Buf_Num
#11 = Buf_Switch(Buf_Free())
if (!Is_SaveAs) {
File_Open("|@(104).OUT",OVERWRITE|NOEVENT)
// } else {
// File_Open_Write(PATHNAME,OVERWRITE|NOEVENT)
}
Buf_Switch(#10)
..


What is puzzling me, is that if I use a command line like
"vpw -x mymacro input.txt -a output.txt" my 'source' becomes
output.txt with the content of input.txt and the output is named
according to the "|@(104).OUT" bit as above.

Is there a way to identify or specify which buffer the "-a "
uses? I'm guessing part of my problems are because I am using an
additional buffer (?).. In-place replacement of the source proved a
little tricky as it's not a 1:1 replacement, thus why I am creating
the additional buffer for the time being.

While poking around, it seems the "Is_SaveAs" flag is the proper way
to check for a "-a" parameter.. Is there a specific internal string
that I can get the -a filename value specifically or is it neccesary
to parse it from CMD_LINE?

--
John
VEDIT SN: 95651
VEDIT (DOS) Ver. 6.12.1 05/07/04
VEDIT (32-Bit) Ver. 6.12.1 05/07/04
VEDIT Pro (64-Bit) Beta Test Ver. 6.12.1 05/07/04
Windows 2000 (5.0.2195 Service Pack 4)

 


Topic: Commandline input / output file buffers? (2 of 16), Read 18 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Wednesday, May 12, 2004 02:38 AM

On 5/11/2004 9:49:28 PM, John H wrote:
>
>What is puzzling me, is that
>if I use a command line like
>"vpw -x mymacro input.txt -a
>output.txt" my 'source'
>becomes output.txt with the
>content of input.txt and the
>output is named according to
>the "|@(104).OUT" bit as above.

John:

I don't exactly understand from your message what you are planning to do.

But here some comments:

"vpw -x mymacro input.txt -a output.txt"

opens "input.txt" and saves it via File_Save_As("output.txt")
immediately. Is_SaveAs indicates that that has happened.
So there is still only one buffer used: file "output.txt"

You now can work directly with the data in that buffer.
A simple File_Save() saves it (still to "output.txt")

A manually/macro File_Save_As(...) would save it under a new name,
still using the same single buffer.

If you want to specify some string in the command line
one way could be:
vpw.exe -c 'RS(12, "some string")' -x mymacro input.txt


Christian

 


Topic: Commandline input / output file buffers? (7 of 16), Read 18 times
Conf: VEDIT Macro Language Support
From: John H
Date: Wednesday, May 12, 2004 07:32 PM

On Wed, 12 May 2004 02:39:11 -0400 GMT, Christian Ziemski wrote:

>>What is puzzling me, is that if I use a command line like "vpw -x
>>mymacro input.txt -a output.txt" my 'source' becomes output.txt
>>with the content of input.txt and the output is named according to
>>the "|@(104).OUT" bit as above.

> I don't exactly understand from your message what you are planning to do.

> But here some comments:

> "vpw -x mymacro input.txt -a output.txt"

> opens "input.txt" and saves it via File_Save_As("output.txt")
> immediately. Is_SaveAs indicates that that has happened.
> So there is still only one buffer used: file "output.txt"

I see, I have since gotten in-place/single buffer use implemented so
that I am a little better off, and can see better the operational
characteristics of some of the stuff I was trying. At the time of
writing I wasn't able to provide proper macro results without using
a second buffer, which seems to make things a little different when
trying to use the -A parameter also.

> You now can work directly with the data in that buffer.
> A simple File_Save() saves it (still to "output.txt")

> A manually/macro File_Save_As(...) would save it under a new name,
> still using the same single buffer.

For certain flexibility/features I am wanting to do, a second buffer
is sometimes desired. I may have to re-think my second buffer
implementation though. It the time I first wrote the second buffer
was being created in order to attain core functionality, whereas now
I maybe should undo that and re-integrate a second buffer in the
perspective of an optional need.

> If you want to specify some string in the command line
> one way could be:
> vpw.exe -c 'RS(12, "some string")' -x mymacro input.txt

I like that, but hope to keep the complexity of the command line to
a minimum.

--
John

 


Topic: Re: Commandline input / output file buffers? (3 of 16), Read 19 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, May 12, 2004 09:18 AM

At 09:50 PM 5/11/2004, you wrote:
>What is puzzling me, is that if I use a command line like
>"vpw -x mymacro input.txt -a output.txt" my 'source' becomes
>output.txt with the content of input.txt and the output is named
>according to the "|@(104).OUT" bit as above.

If your macro is going to set the output filename, using
File_Save_As(), then you shouldn't use the "-a" invocation
option.

What I think you want might be something as simple as:

if (!Is_SaveAs) {
File_Save_As("|(FILEONLY).OUT")
}

If you then:

vpw -x mymacro.vdm input.txt

then your output file will be named input.out

However, if you:

vpw -x mymacro.vdm input.txt -a special.abc

then the "-a" overrides the output filename and it will be
named special.abc.

Ted.

 


Topic: Re: Commandline input / output file buffers? (4 of 16), Read 18 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Wednesday, May 12, 2004 10:08 AM

On 5/12/2004 9:18:45 AM, Ted Green wrote:
>
>If your macro is going to set the output filename, using
>File_Save_As(), then you shouldn't use the "-a"
>invocation option.

But the "shouldn't" is not a "must not", or am I wrong?
(I personally have never used the -a option. I was just curious. And I hope I haven't written too much nonsense in my reply to John's message.)

>What I think you want might be something as simple as:
>
>if (!Is_SaveAs) {File_Save_As("|(FILEONLY).OUT")}
> ...

Hey, good idea. {Archived for possible future use.}


Christian

 


Topic: Re: Commandline input / output file buffers? (5 of 16), Read 17 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, May 12, 2004 10:43 AM

At 10:08 AM 5/12/2004, you wrote:

>But the "shouldn't" is not a "must not", or am I wrong?
>(I personally have never used the -a option. I was just curious. And I hope I haven't written too much nonsense in my reply to John's message.)

I just can't think of any useful situation where you would use both.
But yes, you could use both without problems.

Ted.

 


Topic: Commandline input / output file buffers? (9 of 16), Read 16 times
Conf: VEDIT Macro Language Support
From: John H
Date: Wednesday, May 12, 2004 07:39 PM

On Wed, 12 May 2004 10:43:47 -0400 GMT, Ted Green wrote:

>>But the "shouldn't" is not a "must not", or am I wrong? (I
>>personally have never used the -a option. I was just curious. And
>>I hope I haven't written too much nonsense in my reply to John's
>>message.)

> I just can't think of any useful situation where you would use both.
> But yes, you could use both without problems.

Glad to hear that it's not conflicting. If I am understanding
correctly the operation, I think with the combinations:

1 - console, manually invoked
2 - command line -a specified
3 - command line -a NOT specified (provide a default if -Q)

..is a case where both -A and File_Save_As being used is useful.

--
John

 


Topic: Re: Commandline input / output file buffers? (12 of 16), Read 16 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, May 12, 2004 09:35 PM

At 07:40 PM 5/12/2004, you wrote:
>Glad to hear that it's not conflicting. If I am understanding
>correctly the operation, I think with the combinations:...

John:

Due to a very busy week, including trying to finish 6.12, I will have to postpone answering complex questions in this Conversion. Sorry.

Ted.

 


Topic: Re: Commandline input / output file buffers? (6 of 16), Read 18 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, May 12, 2004 10:50 AM

At 10:28 AM 5/12/2004, you wrote:
>One thing also, I've not tried the "-Onn" paramter but it looks
>helpful.

As far as I can tell, this is an extremely obscure option only available on the DOS version. It was only for non-PC hardware. We used to have versions of VEDIT for some unusual hardware and operating systems.

Ted.

 


Topic: Commandline input / output file buffers? (10 of 16), Read 17 times
Conf: VEDIT Macro Language Support
From: John H
Date: Wednesday, May 12, 2004 07:53 PM

On Wed, 12 May 2004 10:51:19 -0400 GMT, Ted Green wrote:

>>One thing also, I've not tried the "-Onn" paramter but it looks
>>helpful.

> As far as I can tell, this is an extremely obscure option only
> available on the DOS version. It was only for non-PC hardware. We
> used to have versions of VEDIT for some unusual hardware and
> operating systems.

Correction, I was thinking of -N as being helpful. In my
referring to/shuffling through the help writing that message I got
them crisscrossed. -N being useful -O being minimally explained, in
PDF that is..

--
John

 


Topic: Re: Commandline input / output file buffers? (11 of 16), Read 17 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, May 12, 2004 09:32 PM

At 07:53 PM 5/12/2004, you wrote:
>Correction, I was thinking of -N as being helpful. In my
>referring to/shuffling through the help writing that message I got
>them crisscrossed. -N being useful -O being minimally explained, in
>PDF that is..

John:

"-Nnnn" is just a way to pass a numeric argument that a macro can access with N_Option. Nothing more. You might see how CONVERT.VDM uses it, although it is not a trivial macro.

A good way to learn commands is to run {MISC, Wildfile wizard} on the c:\vedit\macros\*.vdm files and then search for a particular command. You will then see how it is used. Most macros have reasonable internal documentation.

Ted.

 


Topic: Commandline input / output file buffers? (13 of 16), Read 17 times
Conf: VEDIT Macro Language Support
From: John H
Date: Thursday, May 13, 2004 08:19 PM

On Wed, 12 May 2004 21:33:10 -0400 GMT, Ted Green wrote:

> A good way to learn commands is to run {MISC, Wildfile wizard}
> on the c:\vedit\macros\*.vdm files and then search for a
> particular command. You will then see how it is used. Most macros
> have reasonable internal documentation.

Good tip. I wanted to find out different handling of newlines with
WF, is there a way I can input to the WF wizard "|F" (|N, |L, etc)
in order to actually show me lines which contain masks with those
patterns?

Quite labor intensive to search for match or search commands and
then visually seeing if "|L, |F or |N" are used.

--
John

 


Topic: Re: Commandline input / output file buffers? (14 of 16), Read 17 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Thursday, May 13, 2004 09:13 PM

At 08:19 PM 5/13/2004, you wrote:
>Good tip. I wanted to find out different handling of newlines with
>WF, is there a way I can input to the WF wizard "|F" (|N, |L, etc)
>in order to actually show me lines which contain masks with those
>patterns?

Sure, to search for a "|F" enter a search string of "||F".

Ted.

 


Topic: Commandline input / output file buffers? (15 of 16), Read 16 times
Conf: VEDIT Macro Language Support
From: John H
Date: Thursday, May 13, 2004 10:09 PM

On Thu, 13 May 2004 21:13:29 -0400 GMT, Ted Green wrote:

>>Good tip. I wanted to find out different handling of newlines with
>>WF, is there a way I can input to the WF wizard "|F" (|N, |L, etc)
>>in order to actually show me lines which contain masks with those
>>patterns?

> Sure, to search for a "|F" enter a search string of "||F".

Thanks! I'm not doing too good. Two relatively dumb questions in a
row. I think my right brain is taking over again.. :-)

--
John

 


Topic: Re: Commandline input / output file buffers? (16 of 16), Read 14 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Friday, May 14, 2004 01:35 PM

At 10:10 PM 5/13/2004, you wrote:
>Thanks! I'm not doing too good. Two relatively dumb questions in a
>row. I think my right brain is taking over again.. :-)

No such thing as dumb questions here. :-)
In any case, you'll have a weekend now to catch up on your R&R and rest your left brain. :-)

Ted.

 


Topic: Commandline input / output file buffers? (8 of 16), Read 18 times
Conf: VEDIT Macro Language Support
From: John H
Date: Wednesday, May 12, 2004 07:32 PM

On Wed, 12 May 2004 09:19:05 -0400 GMT, Ted Green wrote:

>>What is puzzling me, is that if I use a command line like
>>"vpw -x mymacro input.txt -a output.txt" my 'source' becomes
>>output.txt with the content of input.txt and the output is named
>>according to the "|@(104).OUT" bit as above.

> If your macro is going to set the output filename, using
> File_Save_As(), then you shouldn't use the "-a" invocation
> option.

This is essentially part of what I was/am trying to account
for -- provide a default filename if one wasn't specified. Key point
being that I don't want to lock functionality to one approach or the
other if possible.

> What I think you want might be something as simple as:

> if (!Is_SaveAs) {
> File_Save_As("|(FILEONLY).OUT")
> }

> If you then: vpw -x mymacro.vdm input.txt
> then your output file will be named input.out

> However, if you: vpw -x mymacro.vdm input.txt -a special.abc

> then the "-a" overrides the output filename and it will be
> named special.abc.

Hmm, so -a is a way to substitute for, specifically (?),
1-6 or is it connected to 'output specific' File_* commands?

Since I was trying ~ File_Open(PATHNAME) it seems to be the -A will
only be effective with output commands.. Make sense. I was thinking
-A also preformed some internal housekeeping, like creating it's own
buffer and file save environment.

1.PATHNAME Full pathname of the current output (write) file.
2.PATH_ONLY Just the path (directory) of the current file.
3.FILENAME Just the filename of the output file.
4.FILE_ONLY Just the filename without the extension.
5.FILE_EXT Just the filename extension with the "." (period).
6.EXT_ONLY Just the filename extension without the "." (period).
7.INPUT_FILE Full pathname of the current input (read) file.

It appears part of the confusion I had was that -a doesn't appear to
intercede File_Open (?) commands if I my understanding is right (-a
effecting File_Save_* and File_Open_Write only).

--
John