## Kermit 95's Web Browser Interface

Contents:

- The BROWSE Command
- Clicking on URLs
- URL Hot Keys
- Do-It-Yourself URL Hot Spots
- The SE.EXE Program
- Using K-95's Built-In ShellExecute()
- Kermit 95 and Netscape Communicator
- Kermit 95 and Microsoft Internet Explorer

Kermit 95 can activate your Web browser when you Ctrl-click on a Universal Resource Locator (URL) in the Terminal or Command window, or when you give a BROWSE command. By default, URLs that K95 has recognized are highlighted; you can Ctrl-click on any part of a highlighted URL. You can also Ctrl-click on text that K95 has not recognized as a URL, but which you believe your browser can handle anyway, such as "short-form" URLs like www.ibm.com.

The default method for locating and activating the browser is as follows:

- Windows: The `HKEY_CLASSES_ROOT\http\shell\open\command` value from the Registry.

- OS/2: Via path search for `NETSCAPE.EXE` or `EXPLORE.EXE`.

You may override the default in the Dialer's Options..Configure Applications dialog, or by specifing a browser as follows (normally in your `K95CUSTOM.INI` or `K2CUSTOM.INI` file):

`SET BROWSER [ filename [ command-line-options ] ]`
  Use this command to specify the name of your Web browser program, for example:

        set browser C:\Netscape\Navigator2\Program\Netscape.exe -h

  or (note the braces when the filename contains spaces):

        set browser "C:\Program Files\iexplore.exe"

By default, a new instance of the browser is started each time you perform a browse action (because K95 does not know the specific interface to each version of each browser on each platform).

`SHOW BROWSER` displays the current browser.

K95's default method for choosing and invoking the browser was chosen because it is the method that works "out of the box" for the most people. Other methods are described below that you might like better -- if they work!

###

The BROWSE Command

Links: [Next] [Index]

`BROWSE text`
  Invokes your browser on the given text, for example:

      "browse http://www.kermitproject.org/".

Kermit 95 is suspended until the Browser exits (but see below).

###

Clicking on URLs

Links: [Next] [Previous] [Index]

The `\KmouseURL` verb, which is assigned to Ctrl-Button-1 on your mouse by default, is used to start your browser on the URL that you click on. For example, if the text:

      http://www.kermitproject.org/

appears in Kermit 95's Terminal or Command screen, and you move the mouse pointer to anywhere within this text, then hold down the Ctrl key and click button 1, Kermit starts your browser on this URL.

Practically any text is a valid URL for a browser. For example, if you tell your browser to visit "ibm", it might very well be clever enough to try "`http://www.ibm.com/`" (the browser treats any text as a potential URL, whereas K95 has to pick true, well-formed URLs out of arbitrary text streams).

When you Ctrl-click on some text, K95 scans backwards and forwards from the mouse point to determine the boundaries. If the URL has wrapped, K95 does not get the second half because it would have no way of telling the difference between a URL that ended on the right screen margin from one that wrapped. The result of this scan is passed as-is to the browser, except that if it appears to be an email address, then "mailto:" is added to the front of it (if not already there).

The result of the scan is also placed in the variable, `\v(url)`, in case you want to check it or use it later. If the URL ends with a period followed by whitespace, K95 does not include the period, since URLs that appear in email or news postings are likely to be at the end of a sentence, and most URLs do not actually have a period at the end.

Note: You might find that some dexterity is required to click the mouse without moving it. If Ctrl-click on a URL doesn't seem to work, it's probably because the mouse was in motion, and so Windows reported a drag event rather than a click event (in which case, K95 executes whatever is associated with Button 1 Ctrl-Drag, which is "Select text and transmit it" unless you changed it).

###

URL Hot Keys

Links: [Next] [Previous] [Index]

The `\Kurl` verb lets you put the the terminal cursor on any URL and then press the associated key to have your browser visit the URL. Example:

      K-95> set key \375 \Kurl

This makes F8 your URL hot key. Then whenever the terminal window is active, and you can place the terminal cursor on a URL (as you can, for example, in a fullscreen text editor like EMACS, VI, or EDT), you can use this key to go to the site. Handy for mouse-ogynists.

###

Do-It-Yourself URL Hot Spots

Links: [Next] [Previous] [Index]

You can use the following method to let you select any arbitrary text and pass it to your browser. Define a macro like the following in your K95CUSTOM.INI file:

      define URL {
          browse \v(select)
          if terminal-macro connect
      }
      set mouse button 1 alt drag \Kurl

Now you can hold down the Alt key and select text with mouse button 1. When you release button 1, the selected text is passed to your defined browser.

Alternatively you can use "`run start \v(select)`" rather than "`browse ...`"; the effect should be the same.

###

The SE.EXE Program

Links: [Next] [Previous] [Index]

Windows 95 and NT include an API called `ShellExecute()`. Given a character string, this API (a) decides what application is appropriate for it based on a Registry search, (b) checks to see if the application is already running; and (c) if it is, sends a DDE message to the application telling it to process the given string; otherwise it starts the application, giving it the string as an operand.

So, for example, if the string is "`oofa.xls`", ShellExecute() might determine that the appropriate application is Excel, checks to see if Excel is running, and if so, sends a DDE message to it telling it load the `oofa.xls` file; otherwise it starts Excel and loads it with `oofa.xls`. If the string is:

      http://www.kermitproject.org/

then the appropriate application is your primary Web browser. For "`oofa.gif`" it is your GIF file viewer (which might also be your Web browser). For "`oofa.ps`" it is your PostScript previewer, assuming you have one registered.

Note that many applications do not respond to DDE messages; when such an application is invoked via ShellExecute(), a new copy is always started.

A small program called `SE.EXE` is included for use with Windows 95 and Windows NT. It simply calls ShellExecute() on its argument. For example:

      se http://www.kermitproject.org/

passes "`http://www.kermitproject.org/`" to ShellExecute(), which should send your browser (starting it if necessary) to the Kermit website. Similarly,

      se oofa.txt

should start your text editor (such as Notepad) on the `oofa.txt` file, and so on. But exactly what really happens depends on the filetype associations in your Registrey (Windows only) and meny other factors. If you give an argument to SE that it does not understand (i.e. for which there is not an association in the Registry), it does nothing.

If you specify `SE.EXE` as your browser, it is the same as telling K-95 to "set browser" to your preferred browser, except:

1. This does not always start a new copy; if the browser is already running, it simply visits the given URL as if you had brought your browser to the front and did this yourself.

2. If you click on something that is not a URL, this will start the associated application, whatever it is; e.g. clicking on "readme.txt" will probably start a text editor.

To choose `SE.EXE` as your browser:

      SET BROWSER D:\K95\SE.EXE ; (or whatever your Kermit 95 directory is.)

Equivalently, you can enter the pathname of `SE.EXE` in the Dialer's Options..Configure Applications dialog.

You can also use `SE.EXE` as your editor:

      SET EDITOR D:\K95\SE.EXE  ; (or whatever your Kermit 95 directory is.)

This lets Windows pick the appropriate editor for each type of file you want to edit: plain text (`.TXT`), Windows Word (`.DOC`), C language source code (`.C`), and so on, based on Registry entries.

And you can use `SE.EXE` in other ways too. Suppose, for example, you want to download a GIF (graphics) file from a Kermit server and view it as soon as it arrives:

      define gifget set file type binary, get \%1, se \%1

In fact, this will work not only with GIF files, but any other kind of file for which the Windows Registry contains associations.

###

Using K-95's Built-In ShellExecute()

Links: [Next] [Previous] [Index]

In Windows, if you give the following command to Kermit 95:

      SET BROWSER

(by itself, no operands) this tells K-95 to call `ShellExecute()` on any browse actions: the `BROWSE` command, or a `\KmouseURL` event. This is equivalent to:

      SET BROWSER SE.EXE

except that `ShellExecute()` is called from within K-95 itself, rather than through an external program. When this option works, it is to be preferred because it does not cause the creation of any new windows, and it does not force K-95 to suspend itself until SE completes, which could be practically any amount of time.

Internal `ShellExecute()` would be K-95's default browser interface except for the following hitches:

1. `ShellExecute()` is not available in OS/2.
2. It is dependent on the consistency of the Registry entries associated with each URL. Competing products from different vendors frequently cause errors which prevent applications from being executed correctly.

If "`set browser`" (with no argument, i.e. internal ShellExecute()) works for you, by all means use it, but run some tests on your system first to be sure. If it doesn't work, use "`set browser se.exe`" (which might have the same problems, but at least they happen outside K-95), or "`set browser`" to a specific browser program and its arguments.

###

Kermit 95 and Netscape Communicator

Links: [Next] [Previous] [Index]

Netscape Communicator, also known as Netscape 4.x, completely changed its method for invoking its Telnet helper application, and so Kermit 95 1.1.13 and earlier do not work with it (nor do any other Telnet programs that we know about). Earlier versions of Netscape would invoke the Telnet program using the command-line you gave in its Options..General preferences..Apps dialog. with the IP name/address and possibly port appended to it, such as:

      C:\K95\K95 -J xyzcorp.com 2000

(where "`C:\K95\K95 -J`" is what you configured in Netscape, and "`xyzcorp.com 2000`" are the hostname and port added to the command line by Netscape to make the connection.

The Netscape 4.x substitutes some kind of bizarre pseudo-URL that most Telnet applications do not understand for the simple hostname and port. As of version 1.1.14, K95 is capable of parsing these misformatted hostnames. The syntax accepted is:

      [protocol:[:][//][user[:password]@]]host[:port][/]

(where optional parts are enclosed in brackets). This form, as well as the three forms that were accepted originally:

      host
      host port
      host:port

can also be used in SET HOST or TELNET commands and passed on the command line as arguments to "`-j`" or "`-J`". The password, if given, is ignored.

###

Kermit 95 and Microsoft Internet Explorer

Links: [Previous] [Index]

Internet Explorer activates the telnet program that is configured in the Windows 95 or NT registry. There is no means within Internet Explorer to set the Telnet client that you wish to use. The Kermit 95 Registry Tool (`K95REGTL.EXE`) may be used to configure K95 as your default Telnet client.

Click Back on your Browser's Toolbar to return.