/* $VER: TTM-TTSearch.rexx 1.0 (30.5.99) by J. Tierney TTManager Tooltype Search v1.0 5/30/99 J. Tierney Function: Searches the tooltype list for a string. Usage: TTM-TTSearch.rexx [] - A - Test the entire tooltype string. Default. K - Test only the tooltype keyword (left of the "="). D - Test only the tooltype data (right of the "="). Requires: reqtools.library rexxreqtools.library */ OPTIONS RESULTS ADDRESS 'TTMANAGER' ARG opt . IF ~SHOW('L', 'rexxreqtools.library') THEN DO IF ~ADDLIB('rexxreqtools.library', 0, -30) THEN DO SAY 'Could not open "rexxreqtools.library".' EXIT 10 END END 'GETTTLISTTOTAL' ttcount = result IF (rc = 5) | (ttcount = 0) THEN EXIT 0 /* No open window or tooltypes. */ IF opt = 'K' THEN srchtype = ' - Keywords Only' ELSE IF opt = 'D' THEN srchtype = ' - Data Only' ELSE srchtype = '' oldpat = GETCLIP('TTMFindPat') pat = RTGETSTRING(oldpat, 'Text to search for:', 'Tooltype Search' || srchtype, 'From Top|From Current|Cancel','rt_reqpos=reqpos_centerscr') pat = UPPER(pat) IF rtresult ~= 0 THEN DO CALL SETCLIP('TTMFindPat', pat) IF rtresult = 2 THEN DO 'GETTTLISTCURRENT' crnt = result + 1 END ELSE crnt = 0 match = 0 DO WHILE crnt < ttcount 'GETTOOLTYPE' crnt ttype = UPPER(result) x = POS('=', ttype) IF (opt = 'K') & (x ~= 0) THEN ttype = LEFT(ttype, x - 1) /* Only keyword. */ IF opt = 'D' THEN DO /* Only Data. */ IF x ~= 0 THEN ttype = SUBSTR(ttype, x + 1) ELSE ttype = '' END match = POS(pat, ttype) IF match ~= 0 THEN LEAVE crnt = crnt + 1 END IF match ~= 0 THEN 'SETTTLISTCURRENT' crnt END CALL REMLIB('rexxreqtools.library')