Interactive Recognition Patterns

Tony Balinski ajbj at free.fr
Tue Nov 21 17:04:57 CET 2006


Quoting John M Church <john.m.church at lmco.com>:

> Thanks to Thorsten and Joachim for your responses.  The data files can
> be on the order of 1 MB apiece.  Every so many milisec. a list of
> electrical switches (numbered) and their status (on/off) is appended to
> the data file.  If an analyst is interested in a particular set of
> switches he has to do a lot of "finds" with his switch no.  Of course we
> have other, more efficient ways to look at the data (plots) but this
> kind of review has some value at times.
>
> Both of you suggested macros.  I think of macros as generally a sequence
> of actions that one can trigger that does something on an
> instance-by-instance basis (move to the next text that satisfies some
> criteria).  However I admit to not having worked with them much.  I went
> through the help menu last night but it wasn't obvious to me where to
> start (any resources you could suggest for nedit macros?).  In any case
> I want to label/highlight/backlight all the file at once so the user can
> easily scroll back-n-forth, split panes, etc. to see all the switches
> that match.  Can macros do this?  Joachim, I looked at backlighting also
> but it seemed to only apply to the whitespace between the text - not the
> text itself.

NEdit macros do more than replay recorded actions. All the usual structured
programming constructs are available to you when writing macros. The actions
are available as function calls, but more to the point, functions like
search() allow for regex searching in the current window. Fairly limited
interaction with the user is possible in macros using the dialog(),
string_dialog() and list_dialog() functions, allowing for choice selection
and data input.

The built-in backlight feature is a complement to syntax highlighting (SH),
the idea being that "out-of-band" characters can be marked visually without
having SH patterns to detect them. This is not what you want. The visual
effect of backlighting, ie changing the text's background color, can be
achieved using a feature called rangesets. THIS is what you should be reading
about here.

Other than the integrated help, look at:
  http://www.nedit.org/niki/index.php/Macros
  http://www.nedit.org/niki/index.php/Macro%20Collection
and the mailing list archives at nedit.org. See, for example, this simple
"Find All" macro I wrote:
http://www.nedit.org/pipermail/discuss/2006-August/008583.html

Other tricks, like tear-off menus, allow something like toolbar buttons. I
have a set of buttons in a submenu of my macro menu that allow me to move
between the ranges of a range set. I typically tear the menu off (a submenu
becomes an independent window when you click its tear-off dotted line, if it
has one), then use move forward or move back buttons.



More information about the Discuss mailing list