[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
A different search
- Subject: A different search
- From: TBaehr@xxxxxxxx
- Date: Thu, 6 Jun 1996 23:16:55 -0400
Here's a little program that activates the search command each time you press
a key. You start out pressing one key, and the program searches for that
letter or number, highlights it, and prompts you for the next one. Press a
second key, and the program searches for the first two characters, highlights
them, and prompts you for the next one. And so on. You cancel a search with
Esc, stop it with F9, and repeat the same string with F5 (assuming you
haven't remapped these characters--I didn't use keycodes). The backspace key
will back up the search string one character.
You can assign this program to a macro or put it into a U2 file (I assigned
mine to the "S" command). Once I've decided I like it, I may put it into the
next version of ENHANCE.SET and/or perhaps incorporate it into the
menu/dialog system. It does use 2 subroutines from Xy4 dialogs, LeftString
and RightString. You could patch those into your U2 file if you don't use
dialogs (remember to change the JM commands to include the "2." reference).
(A while back I did post an account of the more useful subroutines; these
could form the core of a mini-dialog or U2 file to simplify some programming
with reusable routines.)
SRCH.PGM should run OK in XyWin but not in III+. I wrote a III+ version ages
ago; if I get enough requests, I'll try to dig it out.
A note on the Save/Gets: I tend not to control the assignments very well.
The ones in this program are a bit spaghetti-ish. If you change them, don't
use 01. For some reason (or rather no good reason), 01 is used in LeftString
subroutine.
Tim Baehr
tbaehr@xxxxxxxx
baehr@xxxxxxxx
®GL0¯
Search program goes to each item in succession, building the search string as it goes. Most
searches should take only a few keystrokes. Only normal characters are supported -- no wildcards or
extended characters. Searches are case-sensitive.
®LB0¯®SX99,®VA$FP¯¯®IF®IS99¯==""¯®GL_nofile¯
®EI¯ÿ?}ÿ?®SV11,abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ.,!@#$%^&*()[]{}/'":;<>\|=+1234567890¯®SV02,ÿ?ϯ®SV03,ÿ?+¯®SV04,ÿ? ¯®SV08,ÿ?¯®SV10,¯®SX09,®CP¯¯®LB_Loop1¯®PREsc=Cancel, F9=Done, F5=Repeat¯®SX99,®RC¯¯®IF®IS99¯==®IS02¯¯ÿ?ÿ?«jmp ®PV09¯ÿ?®PRCanceled¯®EX¯
®EI¯®IF®IS99¯==®IS04¯¯ÿ?®PRDone¯®EX¯
®EI¯®IF®IS99¯==®IS08¯¯®GL_Repeat¯
®EI¯®IF(®IS99¯==®IS03¯)&@siz(®IS10¯)>0¯®GL_Pare¯
®EI¯®IF®IS99¯î®IS11¯=>0¯®SX10,®IS10¯+®IS99¯¯®GL_Search¯
®EI¯®GL_Loop1¯
®LB_nofile¯ÿ?«(beep)®PRYou must have a file open.¯®EX¯
®LB_Pare¯®SX40,®IS10¯¯®SX45,1¯ÿ?£(RightString)®SX10,®IS41¯¯ÿ?[ÿ?Kÿ?k®SX05,®CP¯¯®GL_Loop1¯
®LB_Repeat¯ÿ?«sea/f
®PV10¯ÿ?®IF®ER¯¯®GL_Loop1¯
®EI¯ÿ?ÿ?kÿ?«sea
®PV10¯ÿ?®SX05,®CP¯¯ÿ?k®GL_Loop1¯
®LB_Search¯®IF®VA$DF¯==1¯ÿ??ÿ?[®EI¯ÿ?ÿ?«sea/f
®PV10¯ÿ?®IF®ER¯¯ÿ?c®SX40,®IS10¯¯®SX45,1¯ÿ?£(RightString)®SX10,®IS41¯¯;*;
®EI¯ÿ?kÿ?«sea
®PV10¯ÿ?®SX05,®CP¯¯ÿ?k®GL_Loop1¯