Normalized data
As you have probably already seen if you've browsed the OML help file, some commands that use strings require that input be given as "normalized data". This can be pretty confusing until you get the hang of it, as well as with which commands require it and which don't.
Normalized data is a way of expressing strange characters or simple commands with the standard symbols, letters, and numbers found on your average typewriter keyboard. It starts with a backslash, then a letter, and sometimes also a number.
There are two normalized combinations that are used most often; these are "\r", the equivalent of hitting the Return key, and "\x", a character string, roughly equivalent to Chr$.
The first one, "\r", is used whenever you want to include a Carriage Return (a.k.a. "pressing Return") in a string. This is probably most often used in Logon scripts. A few systems may also require a line feed, which is represented by "\n"
The second, "\x", indicates that the next two characters are the hexadecimal (base-16) ASCII code for a character. (These are not visually the same as the decimal ASCII codes, though they have the same value.) Of these, the most commonly used are probably \x09 (Tab) and \x1B (Escape), though any character--including the special ALA characters--can be inserted in this manner. (OML also supposedly includes "\t" for Tab, but I find that it doesn't work like it should; \x09 definitely works.) Note that case doesn't matter in this command; \x1b is the same as \x1B.
Most computer textbooks include an ASCII table listing both the decimal and hexadecimal codes for each character from 0-127/00-7F. The extended ASCII characters, which is where OCLC has put all of the ALA diacritics and other special characters, can be accessed in Windows 95 through the Character Map (Start/Programs/Accessories/Character Map); click on one of the special characters, and the decimal equivalent will be displayed. To convert from decimal to hexidecimal notation, divide by 16. Take the number to the left of the decimal point as the first digit; if it is higher than 9, convert it to a single digit by following the pattern 10 = A, 11 = B... 15 = F. Now multiply the fraction to the right of the decimal point by 16 and make the result the second digit; converting to A-F if necessary.
Knowing the combination for Escape can be handy, as it then allows for "escape codes"; this the main method for inserting arrow keys, function keys, and Control-[letter] commands into a macro. Not necessarily all that useful for OCLC work (both cursor movement and function key commands are much more easily achieved by using other commands), but invaluable when using PfW to telnet elsewhere.
Discovering the codes for these keys is usually as simple as recording a macro and pressing each of the keys you want to know, separated by some character you'll recognize later as not being part of the control codes. (I'd suggest something such as an asterisk or an equal sign, and also the key or key combination you pressed.) When you go to edit the recorded macro, you'll find all of the escape codes you're interested in knowing. For example, if you were looking for the up and down arrows, you might get a result of "\x1B[A=UpArr\x1B[B=DnArr", from which you can easily take out what you typed manually to get the codes you want.
If you want to include characters in a normalized string that are usually used as part of the normalization or the string definition--that is, double-quotation marks and backslashes, you do not have to use a hexadecimal workaround (though that will also work); these characters have their own normalizations, which are gotten simply by putting a backslash immediately in front of them. That is, "\"" is a double-quote, and "\\" is a backslash.
As far as using normalized data, it's just a matter of including it in a string. For example, here's a rudimentary logon macro for a typical VT100 telnet session:
sub main
Dim CS as Session
Set CS = CurrentSession
CS.Receive, 10, "Logon:"
CS.Send "username\r"
CS.Receive, 10, "Password:"
pass$ = "mypass\r"
CS.Send pass$
end sub
It waits for the indicated text, then sends the logon or password, followed immediately by the Return key. Note that the normalized text must be inside the double-quote marks. The other end receives each character as if it were typed by the user, including the Return key at the end, and handles it normally. For the password, this example shows one way of using string variables to achieve the same end. Note that some people may find it easier if you use "mypass" + "\r" instead of the example above; this way, one can better tell where the regular data ends and the special characters begin. This can be especially important when the normalized data is in the middle of a string. For example, here are two ways of presenting the same data:
a$ = "\xDC\x0910 100 1\x09Twain, Mark.\xDD" b$ = "\xDC\x09" + "10 100 1" + "\x09" b$ = b$ + "Twain, Mark." + "\xDD"
There are a few extended ASCII characters in there (in OCLC terms, delimiters or diacritics), as well as a couple of tabs. The first example is a jumble of characters, though it's not too difficult to eventually puzzle it out by watching the slashes. The second clearly delineates between the normalized special characters/commands and the plain text.
Next time, loops...