Topic: Version output for external use (1 of 9), Read 18 times
Conf: VEDIT Macro Language Support
From: John H
Date: Wednesday, April 28, 2004 04:40 PM

Hi,

After fiddling around some came up with this. There didn't seem to
be a clear and obvious way to get the version info by other means.
Although I could grab the file version info from vpw[64].exe, the
build date nor dos version info can be gotten this way.

----------8<-------------------
// VE-VER.VDM Date: 04-28-2004 Time: 15:10:00
//
// Macro to output version information of vpw[64].exe and vedit.exe
// to a text file. IE: proper version info for support emails
//
// syntax: vedit|vpw -g -q -x ve-ver
//
// the "-g" parm is used simply to bypass the errors / block to run
// this macro with a DOS-WINDOWS sharded installation of VPW 6.12 &
// VEDIT 6.11
//
// Output file is 8.3 to maintain functionality with VEDIT.EXE

Out_Reg(103)
Version()
Out_Reg(CLEAR)
Reg_Save(103, "VE_VER.TXT", OK)
----------8<-------------------

I had first tried to simply pipe the info out to a text file in
various ways but never got any results..

EG:

vpw -q -c version -a ver.txt
vpw -q -c "Out_OS() Version" > ver.txt
vpw -q -c "Out_OS() Version" -a ver.txt
etc..

Anyhow, the macro seems to do the basic operation that I was after
but I welcome any comments.

--
John
VEDIT (32-Bit) Ver. 6.12.1 03/28/04
Windows 2000 (5.0.2195 Service Pack 4)

 


Topic: Re: Version output for external use (2 of 9), Read 17 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, April 28, 2004 05:19 PM

At 04:41 PM 4/28/2004, you wrote:
>After fiddling around some came up with this. There didn't seem to
>be a clear and obvious way to get the version info by other means.
>Although I could grab the file version info from vpw[64].exe, the
>build date nor dos version info can be gotten this way.

Your method seems to be the best there is. Since the version() command includes the build date and DOS/Windows version text, I don't know what else you are looking for.

>I had first tried to simply pipe the info out to a text file in
>various ways but never got any results..
>
>EG:
>
>vpw -q -c version -a ver.txt
>vpw -q -c "Out_OS() Version" > ver.txt
>vpw -q -c "Out_OS() Version" -a ver.txt

No, VEDIT (and Windows programs in general) never output to STDOUT.

You could have:

vpw -q -c"or(103) ver() or(clear) rsav(103,'VE_VER.TXT',OK) qally"

(Careful about usage of double-quotes and single-quotes.)

Ted.

 


Topic: Version output for external use (3 of 9), Read 18 times
Conf: VEDIT Macro Language Support
From: John H
Date: Wednesday, April 28, 2004 07:36 PM

On Wed, 28 Apr 2004 17:19:53 -0400 GMT, Ted Green wrote:

> Your method seems to be the best there is. Since the version()
> command includes the build date and DOS/Windows version text, I
> don't know what else you are looking for.

The full version info was all I was after. Perhaps this isn't the
perfect topic area for me to have posted that. I didn't intend to
prompt a support effort.

Is there a more suitable macro language learning/discussion section?
I feel a little awkward as I don't have years of working with vedit
under my belt and quit a bit here is much more advanced than I've
grasped yet.

> vpw -q -c"or(103) ver() or(clear) rsav(103,'VE_VER.TXT',OK) qally"
> (Careful about usage of double-quotes and single-quotes.)

Thank you, Ted. That is a nice example of using invocation options &
commands.

--
John

 


Topic: Re: Version output for external use (4 of 9), Read 19 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, April 28, 2004 09:02 PM

At 07:37 PM 4/28/2004, you wrote:
>The full version info was all I was after. Perhaps this isn't the
>perfect topic area for me to have posted that. I didn't intend to
>prompt a support effort.
>
>Is there a more suitable macro language learning/discussion section?
>I feel a little awkward as I don't have years of working with vedit
>under my belt and quit a bit here is much more advanced than I've
>grasped yet.

We welcome all macro related questions here. Thank you for joining this conference. :-))

Ted.

 


Topic: Version output for external use (5 of 9), Read 20 times
Conf: VEDIT Macro Language Support
From: John H
Date: Thursday, April 29, 2004 01:00 PM

Hi, I made some additions and came up with this. I read about text
register use and am not quite clear if I ought to be using 103-106
or 10-90 or if it really matters in this case.

I modify the DOS version string by adding "(DOS)" to it. The way I
was wanting to determine that the string came from vedit.exe was to
check the VEDIT_EXE for VEDIT.EXE but I had already worked out the
way shown below and got frustrated trying to parse a T-Reg for a
substring.

Anyhow, the macro is something which I am bothering with so that I
don't have to remember to include the proper information in case of
a support related email. I use The Bat! for email and I will be
complementing this macro with a plug-in for TB! that will read and
insert the version/date/sn info to email messages as needed. If
anyone is using TB! and would like a reply template for WebBoard or
is interested in the other widgets I've made, they can be found at
my little webpage: http://cu2.home.comcast.net

----------8<-------------------
// Macro to output version & serial number information of vpw[64].exe
// and vedit.exe to a text file with windows INI file structure.
//
// syntax: vedit|vpw[64] [-g] -q -x ve-ver
//
// The "-g" parm is used simply to bypass the errors / block to run
// this macro with a DOS-WINDOWS shared installation of VPW 6.12 &
// VEDIT 6.11
//
// Output file is 8.3 named to maintain functionality with VEDIT-DOS

Reg_Set(10, "VEDIT") // store in text register 10

Out_Reg(11) // redirect output to text register 11
Version() // output vedit version & build date
Out_Reg(CLEAR) // end output redirection

// Use v6.12 specific command if possible avoiding BAK creation

if (Version_Num >= 612) {
File_Open_Write("VED-VER.INI", OVERWRITE)
} else {
Buf_Switch(Buf_Free(EXTRA))
}

// assemble and add "[VEDIT]" section string then add
// "Version=" section item and value

Ins_Text("[")
Ins_Text(@10)
Ins_Text("]")
Ins_Newline(1)
Ins_Text("Version=")
Ins_Text(@11)

BOF // jump to begining of buffer for search

Search("|@(10)|B", ADVANCE) // search for "VEDIT "
if (Match("V")==0) { // if Version() output changes
Ins_Text("(DOS) ") // this will need fixing --
} // haven't figured out how to
// parse VEDIT_EXE string

EOF // jump to end to add "SN=" section item

Ins_Text("SN=")

// check for VEDIT.INI in user area assume home if not found

if (File_Exist("|(USER_CFG)\|@(10).INI")) {
Reg_Set(12, USER_CFG)
} else {
Reg_Set(12, HOME)
}

Reg_Set(12, "\", APPEND) // assemble VEDIT.INI filespec
Reg_Set(12, @10, APPEND) // store in text reg 12
Reg_Set(12, ".INI", APPEND)

#10=Buf_Num // store working buffer num
File_Open("|@(12)", BROWSE) // before opening file/buffer
Search("| if (Match("|D|D|D|D|D")==0) { // locate SN item and store value
Reg_Copy(13, 1) // to text register 13
} else {
Reg_Set(13, "NONE")
}

File_Quit(OK) // close VEDIT.INI and return to work buffer
Buf_Switch(#10)

Ins_Text(@13) // add the serial number to "SN=" item

// save avoiding creation of BAK file for pre v6.12

if (Version_Num < 612) {
#10 = Config(F_BACKUP_MODE, 0)// save existing value then turn off
File_Save_As("VED-VER.INI", NOMSG+OK)
Config(F_BACKUP_MODE, #10) // restore original value
}
----------8<-------------------

Comments and suggestions welcome!

--
John

 


Topic: Re: Version output for external use (6 of 9), Read 20 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Thursday, April 29, 2004 05:04 PM

John:

On Thu, 29 Apr 2004 13:00:00 -0400, you wrote:

>Hi, I made some additions and came up with this. I read about text
>register use and am not quite clear if I ought to be using 103-106
>or 10-90 or if it really matters in this case.

You can think of T-Regs 103-106 as more temporary as 0-99.
Usually registers >99 are used internally or very(!) temporary.

So a macro shouldn't and can't be sure to have 103-106 be the same on
a second call.

The user registers 0-99 are (can be) a bit more "safe", e.g. with
Reg_Push/Reg_Pop.

Of course you can push/pop 103-106 too, but as I said in the first
sentence: think of them as somewhat temporary.

Have a look at some macros:
Many of them begin with Reg_push(...) and end with Reg_Pop(...) to
save and restore used registers.
But 103-106 are usually used without that.


>I modify the DOS version string by adding "(DOS)" to it. The way I
>was wanting to determine that the string came from vedit.exe was to
>check the VEDIT_EXE for VEDIT.EXE but I had already worked out the
>way shown below and got frustrated trying to parse a T-Reg for a
>substring.

Yes, T-Regs are for storing data, not for working/searching/modifying
the data (with few exceptions like Compare)


>// Use v6.12 specific command if possible avoiding BAK creation
>
>if (Version_Num >= 612) {
> File_Open_Write("VED-VER.INI", OVERWRITE)
>} else {
> Buf_Switch(Buf_Free(EXTRA))
>}

Why not simply use a
File_Delete("VED-VER.INI", OK)
at the beginning and then write the new file as usual?


>Search("|@(10)|B", ADVANCE) // search for "VEDIT "
>if (Match("V")==0) { // if Version() output changes
> Ins_Text("(DOS) ") // this will need fixing --
>} // haven't figured out how to
> // parse VEDIT_EXE string

Perhaps you are loooking for
Ins_Text(VEDIT_EXE)


Christian

 


Topic: Version output for external use (7 of 9), Read 21 times
Conf: VEDIT Macro Language Support
From: John H
Date: Thursday, April 29, 2004 07:07 PM

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

Hi Christian, thank you for the comments! Very helpful.

>>// Use v6.12 specific command if possible avoiding BAK creation
>>
>>if (Version_Num >= 612) {
>> File_Open_Write("VED-VER.INI", OVERWRITE)
>>} else {
>> Buf_Switch(Buf_Free(EXTRA))
>>}

> Why not simply use a
> File_Delete("VED-VER.INI", OK)
> at the beginning and then write the new file as usual?

I hadn't thought about that approach. When I create a new file
and save it, I get 0 size BAK files.. Won't that happen here too?

>>Search("|@(10)|B", ADVANCE) // search for "VEDIT "
>>if (Match("V")==0) { // if Version() output changes
>> Ins_Text("(DOS) ") // this will need fixing --
>>} // haven't figured out how to

> Perhaps you are loooking for
> Ins_Text(VEDIT_EXE)

Yes, I wasn't aware that I need to place VEDIT_EXE into a buffer in
order to check for the presence of a sub-string.

--
John

 


Topic: Re: Version output for external use (8 of 9), Read 19 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Friday, April 30, 2004 03:44 AM

John:

On Thu, 29 Apr 2004 13:00:00 -0400, you wrote:


>Search("|@(10)|B", ADVANCE) // search for "VEDIT "
>if (Match("V")==0) { // if Version() output changes
> Ins_Text("(DOS) ") // this will need fixing --
>} // haven't figured out how to

Perhaps the commands

Is_Windows
Is_WinNT
Is_Win32_Version

are helpful for your macro too...

Christian

 


Topic: Version output for external use (9 of 9), Read 16 times
Conf: VEDIT Macro Language Support
From: John H
Date: Sunday, May 02, 2004 09:29 PM

On Fri, 30 Apr 2004 03:44:39 -0400 GMT, Christian Ziemski wrote:

> Perhaps the commands

> Is_Windows
> Is_WinNT
> Is_Win32_Version

> are helpful for your macro too...

Hi Christian, I'm guessing to also provide OS info..for support
emails?

My mail agent can handle that information for me. :-)

I got it all together now between a simple plug-in for the mail
client and the VDM, inserting OS, VEDIT version, build date and the
5 digit serial number is automatic.

Although I don't figure it's going to be useful day in and day out,
it was a good exercise.

--
John