In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
Home page Home page Home page Home page
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel

Capture Playback and Convert.Keystrokes

Way back in Volume 1 we showed how @Playback could be loaded with a capture script for instant replay of captures. Recently a number of people have reported a problem with capture scripts, namely that embedded code and commands no longer work as they ought. For example, the script

     @HLP Here we are in the demo window@
     1234 {CR}

ought to invoke the Demo window (if run from TCL), pause and display a help message, then after a key was pressed, continue on and enter 1234 into the key field. What in fact happens is that this script fails to run.

Examination of CONVERT.KEYSTROKES, the routine responsible for converting text to and from internal form (scan codes, escape sequences et al) to external form ({F1}, {ALT-8} et al) identifies this problem.

CONVERT.KEYSTROKES takes four parameters as follows :-

    String     The string to be converted to or from internal form

    Action     "W" for convert to, "K" for convert from

   Unknown     Does not seem to be used

      Flag     Returns result of operation, 1 for failed, 0 for OK

The string to be converted is both passed and returned in the first parameter. If the conversion is successful, a string is returned suitable for placing directly into @PLAYBACK. If the conversion fails, the string is unchanged and Flag is set to 1.

Thus for the above script we would establish the call

0001    STUFF    = "WINDOW {SPACE} DEMO {CR} "
0002    STUFF<-1>= "@HLP HELLO@"
0003    STUFF<-1>= "1234 {CR}"

However, this call fails to convert and returns a Flag of 1. Removing the "LP" from the "HLP" causes the conversion to work. Further examination reveals that any Catalyst code of more than one character now causes the conversion to fail, hence the failure of an HLP. The good news is that catalyst calls of only one character still function, so until this problem is resolved it can be worked around by using the following subroutine, which simply takes a branch and treats it as a code and command.

0001    Subroutine Replay(Branch)
0002      SavePlay = @Playback
0003      @Playback = ""
0004      Code = Branch[1, "*"]
0005      Command = Branch[-1, "B*"]
0006      Call Catalyst(Code, Command)
0007      @Playback = SavePlay
0008    Return

Then our script would become

     @S REPLAY,HLP*Here we are in the demo window@
     1234 {CR}

Note though that the * delimiter will need to be changed if you wish to do B catalyst calls etc.

(Volume 4, Issue 10, Pages 4,5)
Pixel Footer R1 C1 Pixel