[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: RX Function Call
- Subject: Re: RX Function Call
- From: "Carl L. Distefano" CLDistefano@xxxxxxxx
- Date: Wed, 26 Feb 1997 12:44:05 EST
** Reply to note from "EBERLE, JIM" Wed, 26 Feb 97 14:39:10 +0000
Jim writes:
-> I've just come across a really neat function call, RX, in
-> XyWrite 4 that appears to work differently -- and better --
-> than the documentation states. Maybe this is old hat to most
-> of you, but RX does a lot more than execute the last set of
-> recorded keystrokes.
-> ...
-> I use a control key, F, to search across files
-> 33=BC,s,e, ,c,:,*,.,*,/,/,CL When this
-> appears on the command line, I drop in the words I want to
-> search for. When I've found what I want, I invoke O to open
-> the document. That takes me to the top of the document so to
-> get to the search word I do the following using another control
-> key, O. On that key is the following: 24=BC,s,e, ,/RX/
->
-> The command line shows only se and a space. By hitting the
-> enter key, the word I previously entered on the across files
-> search appears and the new search is executed.
Jim: Nice result, but nothing to do with func RX! In your
keyboard-file code ("24=BC,s,e, ,/RX/"), it's clear that func RX
is *not* executing, because commas required after the space have
been omitted. Thus, everything after the space is ignored, and
"the command line shows only se and a space".
What you're seeing is a little-known (undocumented?) feature of
the SEarch command in Xy4: issuing a bare SE command (no search
string) causes the last-used search string (returned,
incidentally, by ) to be inserted on the CMline immediately
before execution. Thus your second key assignment can be
truncated to "24=BC,s,e"; or, for immediate execution,
"24=BX,(,s,e,)".
Note, however, that the SEarch command, as written, will flag only
the *first* instance of your search string in the newly-opened
file. If, in your cross-file search, you'd selected Continue one
or more times (i.e., passed over some instances of the search
string before Opening the file), you would need to execute the
SEarch command *multiple times* in order to get to place you were
looking at when you hit Open. Fortunately, Xy4 provides the tools
for automating this; unfortunately, there are substantial
limitations.
When an across-files search begins, the word-count variable
is reset to 0 and increments with each hit. Thus, if you
press C (for Continue) twice and Open on the third hit,
will equal 3. You can then use the SEarch command's numeric
switch to search for the third instance of the string:
24="BX,(s,e,/,3,)".
Of course, you wouldn't want to hard-code "3" into your keyboard
file. You'll need some XPL to accommodate the fact that the
numeric parameter will vary. A simple program (needless to say,
using real guillemets and a true func BX), such as ...
>BX (se/)
.. SAved to disk and LDPMed to a key, or loaded as a part of a U2
Help file and executed via a Helpkey, would work.
BUT: there's a catch. If there are multiple hits across files,
the bare SEarch doesn't work as expected after the first file.
Regrettably, is not reset to 0 between files, so that the
counter will be off (too high) come the within-file SEarch. So,
maybe your original solution ("24=BC,s,e"), eXeCuted manually as
many times as necessary to reach the target string, is better
after all!
Either way, there's another pitfall: Whereas cross-file searches
always proceed in eXPanded view, Opening causes the file to be
displayed in the default view -- almost invariably something other
than eXPanded. In this case, the manual search may not find
instances of the search string (notably, in footnotes and other
embedded text) that were flagged by the cross-file search. It's
something to be aware of if you work with embedded text.
Undoubtedly there are XPL workarounds. As math teachers say,
I'll leave that as an exercise.
--------------
Carl Distefano * * * CLDistefano@xxxxxxxx
--------------