Topic: HTML date stamp macro - Suggestions (1 of 5), Read 20 times, 1 File Attachment
Conf: VEDIT Macro Language Support
From: John H
Date: Tuesday, April 27, 2004 01:29 AM

Hi,

in my relative ignorance of vedit, I cobbled together a
'File-Pre-Close' macro I use with File-Open-Config to date
stamp my html files, without really knowing if this
capability was already available.

Since this is my first macro I'd appreciate any feedback, help,
suggestions, etc.

--
John
VPW[64] 6.12.1 & VEDIT 6.11.1
Windows 2000 (5.0.2195 Service Pack 4)

 
MOD_DATE.VDM (2KB)

 


Topic: HTML date stamp macro - Suggestions (2 of 5), Read 15 times, 1 File Attachment
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Wednesday, April 28, 2004 02:19 AM

On 4/27/2004 1:29:35 AM, John H wrote:
>
>Since this is my first macro I'd appreciate any feedback,
>help, suggestions, etc.

John:

Your macro is nice done for your first VEDIT macro!

Since you asked for comments, here we go...


Some comments to your macro (my *personal* opinion and style):

1)
Search("(!--MOD@DATE-->",ERRBREAK)
Char(15)

can be done in one command:

Search("(!--MOD@DATE-->",ERRBREAK+ADVANCE)

2)
if(Match("|D|D|D|D|045|D|D|045|D|D")==0)

can be written as

if(Match("|D|D|D|D-|D|D-|D|D")==0)

to be better readable.

3)
Goto MODATE

Goto's should be avoided.
They may produce unstructured, hard to maintain macros.

4)
Ins_Newline(1)
Char(-2)

Newlines are not always 2 bytes long. If you are editing
Unix-style text it's only a <LF> for example.

There is a variable to help here:
Newline_Chars
Number of chars in "newline" (See "File Types"). "0" in record/binary mode.



I attached another version of your macro to this message: how I would code it (e.g.).
Perhaps you can get some more infos from that.

Christian

 
MOD_DATE-2.VDM (1KB)

 


Topic: HTML date stamp macro - Suggestions (3 of 5), Read 12 times
Conf: VEDIT Macro Language Support
From: John H
Date: Wednesday, April 28, 2004 02:04 PM

On Wed, 28 Apr 2004 02:21:19 -0400 GMT, Christian Ziemski wrote:

> Some comments to your macro (my *personal* opinion and style):

Thank you Christian, the 1-4 explanations are a helpful and in
hindsight are clearly a better approach than what I had.

Could you clarify the Out_Reg() vs Out_Ins() a little? Is there a
specific reason you kept the one instance of Out_Ins (or why used
Out_Reg in place of Out_Ins)?

Seems Out_Reg or Out_Ins could be used exclusively. I'm not clear on
the need to use both.

--
John

 


Topic: Re: HTML date stamp macro - Suggestions (4 of 5), Read 11 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Thursday, April 29, 2004 05:04 PM

John:

On Wed, 28 Apr 2004 14:04:00 -0400, you wrote:

>Could you clarify the Out_Reg() vs Out_Ins() a little? Is there a
>specific reason you kept the one instance of Out_Ins (or why used
>Out_Reg in place of Out_Ins)?

I used Out_Reg where it's possible: In the version for VEDIT 6.12.
Here the new Date(REVERSE) already gives the needed result.
And so this part is easy and short.

In pre-6.12 both of us used Out_Ins() since the Date() output has to
be reformatted before further use.
And that is only possible in a text buffer. Hence the Out_Ins().

>Seems Out_Reg or Out_Ins could be used exclusively. I'm not clear on
>the need to use both.

I used one *or* the other - dependant on VEDIT version, not both.

Hopefully it's a bit more clear now. If not: Simply ask.

Christian

 


Topic: HTML date stamp macro - Suggestions (5 of 5), Read 13 times
Conf: VEDIT Macro Language Support
From: John H
Date: Thursday, April 29, 2004 06:50 PM

On Thu, 29 Apr 2004 17:05:01 -0400 GMT, Christian Ziemski wrote:

>>Seems Out_Reg or Out_Ins could be used exclusively. I'm not clear on
>>the need to use both.

> I used one *or* the other - dependant on VEDIT version, not both.

Yes, my confusion was showing. I think that the difference is clear
to me now. I read more about text registers and buffers and am
understanding better the distinction between them.

--
John