• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to? Incorporate tables from HELP into batch file

Many HELP pages contain tables where one column of the table shows a set of codes and another column shows the corresponding text. In some cases the codee is used as a parameter to a command or function, in others it is a return value. For example, @WININFO - input parameter value v. what information will be returned means; @DRIVETYPE - return value vs. description. @SERVER has two informal tables: one for the second parameter's value v. what will be returned, and for the case when the second parameter's value is Type lists what each bit of the returned value means.

One often wants to display the text associated with the codes. Embedding them in a batch file (or for that matter in any other source code) permanently is not a good option, since a new version (or sometimes a new build) of TCC may change the table (hopefully only by additions). I am looking for a way to access the information dynamically from TCC. One possible method is by including it in one or more files included in the TCMD distribution.

Charles Dye made a big step in this direction in the @SHFOLDER function of his uistuff.dll by permitting the use of the CSIDL names.
That's what I currently do - highlight the relevant HELP page section, copy and paste it into my .BTM, and go through major editing effort to convert it to code. When the next HELP version comes out, repeat it. The original effort I do not mind. It's the repeat effort that I wish to avoid. If each table became a text file, or - better yet - all the tables become a database directly accessible from TCC, new versions would not require new effort for old features. This is in the same sense as I did not like that the 4DOS variables _APMAC and _APMBATT were renamed to _ACSTATUS and _BATTERYPERCENT in 4NT without change in function simply because the information was obtained through a different mechanism. (I admit the new names are more descriptive, and in the long run better.)

Maybe I should submit this as a feature request. Oops, I cannot without withdrawing my vote from some other request.
I do use hard coding now; my worry is that some table changed since I first embedded it and I did not update the code.

I came across yet another table I am now interested in, and was looking how I could automate the code generation. The mechanical manipulation of the table was easy. Building a test for 26 bits as 26 separate "if ... echo ..." form is tedious. I thought of loading the code/string pairs into an array I can cycle through, which requires loading the array first. A separate file with @FILEARRAY would do it. Another method is using explicit SET for each array element. I was looking at HERE-document and TEXT command. If I am not using an external file which is part of the TCMD distribution, I prefer to have the code in a single file, without an external data file, for maintainability. I suppose I could put the data in a stream file of the batch file, but my backup USB devices are VFAT, I am worried about losing them.

If this were a one-time deal, I'd have just done it, but it comes up every now and then, so I appreciate new ideas.
Hmmm! With HH.EXE you could de-compile the help file. Then with little (?) scripts, extract the tables you want from the HTM files and save them as you wish. This (below) wasn't too hard and the result is almost in a usable format. I turned tags into newlines and then got rid of empty lines. Quite possibly, TPIPE could do that (and more).
v:\jphelp> grep "A LAN" f_server.htm | sed -e "s/<[^<>]*>/\n/g" | grep .
A LAN Manager workstation
A LAN Manager server
Any server running with Microsoft SQL Server
Primary domain controller
Backup domain controller
Server running the Timesource service
Apple File Protocol server
Novell server
LAN Manager 2.x domain member
Server sharing print queue
Server running dial-in service
Unix/Linux server
Windows Server 2003, Windows XP, Windows 2000, or Windows NT
Server running Windows for Workgroups
Microsoft File and Print for NetWare
Windows server that is not a domain controller
Server that can run the browser service
Server running a browser service as backup
Server running the master browser service
Server running the domain master browser
Windows 95/98/Me
Server clusters available in the domain
Terminal Server
Cluster virtual servers available in the domain
Servers maintained by the browser
Primary domain
I may be missing something here, but why not use TPIPE to filter the Online Help web page to the desired results on your system? For example, http://jpsoft.com/help/index.htm?f_wininfo.htm
(Of course) my example works just as well with the online help page. And though TPIPE could probably to it, I'm not up to that struggle right now.
v:\> type "http://jpsoft.com/help/f_server.htm" | grep "A LAN" | sed -e "s/<[^<>]*>/\n/g" | grep ."
A LAN Manager workstation
A LAN Manager server
It wasn't too much of a struggle. It's too bad TPIPE's /input can't be a URL.
v:\> type "http://jpsoft.com/help/f_server.htm" | tpipe /grep=3,0,0,0,0,0,0,0,"A LAN" /replace=4,0,0,0,0,0,0,0,0,"<.*>","\r\n" /simple=10
A LAN Manager workstation
A LAN Manager server
Joe, is there a URL where I can find this?
Thanks, Steve
My TPIPE tips and tricks notes is just a KeyNote file that I have on my local system, with information I have gleaned from forum messages about TPIPE. Each note contains sample code, with URL links to the forum message from which the sample code originated. If you do a Google search for

tpipe site:jpsoft.com
and limit it to the past year, you will find most of the TPIPE tips and tricks that I have in my KeyNote file.


A couple of examples;
Vince, it looks very nice, but I would have to hand copy character by character the command, since .png files are graphics, not text.
Joe, is there a URL where I can find this?
Thanks, Steve
v:\> type "http://jpsoft.com/help/f_server.htm" | tpipe /grep=3,0,0,0,0,0,0,0,"A LAN" /replace=4,0,0,0,0,0,0,0,0,"<.*>","\r\n" /simple=10 /replace=4,0,0,0,0,0,0,0,0,"^([01248x]+)\r\n","$1\t" /replace=4,0,0,0,0,0,0,0,0,"^([01248x]{1,7}?\t)","$1\t"
Top Bottom