Saturday, June 17, 2006

More on HTML-RTF for English BIble

There's an improved version available with fewer bugs: at

Changes include better handling of paragraphing and curly quotes (although mdash still needs some work for RTF).

What does the program illustrate? Two things, primarily:

(1) How to retrieve HTML code for a Web page at a certain URL, how to extract data from the Web page, and how to create HTML code for a new Web page making use of that extracted data.

(2) How to create an RTF file.

The latter doesn't really "create" an RTF file from scratch: It simply modifies an existing RTF file, inserting text, superscripts, etc., where appropriate.

Using this approach, you can get by without really understanding the details of RTF (which can be a Good Thing).

Thus the beginning and the end of the RTF file that is created is taken from an already-existing RTF file. (If you'd like, say, a different font, then either modify the code appropriately or use WordPad to create what you want and save that as an RTF file to use as your starting point.)

Right now I'm working on a program which - if you provide an address (street, city, state, and zip) - will give you the latitude and longitude for that location. When finished, I expect (as usual) to make it available to readers of this blog.

You may have little use for such information, but the point is that the program is another sample program illustrating how to use REALbasic to retrieve information from the Web.

It so happens that I do have a practical use for such a program, but even a useless program has its usefulness if it can be used as a sample program from which one can build a more useful program.

I'd be interested in hearing about (or seeing other examples of) how people are putting HTMLViewer and HTTPSocket to use in their programs.

Barry Traver

P.S. Here's a list of what the abbreviations stand for in the Bible translations mentioned last time: KJV - King James Version, NASB - New American Standard Bible, NIV - New International Version, NKJV - New King James Version, and ESV - English Standard Version.

Friday, June 16, 2006

HTML-RTF: Another Web-Related Program

HTML-RTF is a program I wrote for a friend who is the Web manager of a church denominational Web site. It make use of data retrieved at

OK. Here's what the program does (as I described it to him)....

"You indicate Testament (O.T. or N.T.), Book, Chapter, Verses, and Translation (choice of five for now, KJV, NASB, NIV, NKJV, and ESV). You click on 'Make HTML.'

"The program makes the HTML and displays the result in two panes in the window. The bottom pane displays the HTML code, and the top pane displays what the HTML code will look like in a standard Web browser. In addition, the program will put the HTML code into the Windows clipboard. ready to paste, say, into a field in the admin editing area for "Devotional" or whatever.

"Next you use File --> Save as RTF to save the equivalent in RTF format (so that the RTF file can be later Inserted into a WPWin or WinWord document).

"The program at this point preserves (for both HTML and RTF) the Scripture text, superscripted verse numbers, italics, and "curly quotes" (single and double). It is also specifically set NOT to show notes or cross-references. In addtion, for KJV each verse is put on a separate line, while for other translations the verses are divided into multi-verse paragraphs (with a blank line between paragraphs). Section headings within the passages are automatically removed.

"You have to be on the Internet (preferably broadband) to use this program. Also, the first time you run it, if you're running a firewall give your firewall a few moments to ask you if you want to allow my program to access the Internet. (Say, 'Yes.')"

My coding is a bit sloppy (I hope to post a cleaned-up version sometime in the future), but you should be able to figure out basically what's going on. (As usual, you'll find thte source code,, at

The program has been tested on Windows, but not on the Mac or Linux. (I hope to have some comments on the coding for you in the next blog entry.)


Barry Traver

P.S. Please send bug reports and other commments to me at Thanks!