Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

waitlist.was to change keyword colors

Status
Not open for further replies.

billwoo1

Technical User
Sep 21, 2006
7
US
This site has been a great help in my writing aspect files. How could I modify the waitlist.was to change text colors when it hits a keyword? If it finds "error" then red or "T1" it turns green etc...I know I use termwrites and waitfor but imm foggy on the rest. Thanks

; Global var for WaitList() procedure
INTEGER WaitListStat = 0

;***************************************************************************
; Wait for a list of up to three strings
;
; Passed: INT: maximum # of seconds to wait
; STRING: Data string #1
; STRING: Data string #2
; STRING: Data string #3
;
; Use $NULLSTR to ignore a parameter.
;
; On Exit: Global WaitListStat = Data string # or 0
;***************************************************************************
PROC WaitList
PARAM INTEGER maxTime
PARAM STRING string1, string2, string3

INTEGER loopControl

#IFDEF ASPDEBUG
STRFMT S0 "WaitList on `"%s`" `"%s`" `"%s`"" string1 string2 string3
#ENDIF

WaitListStat = 0

WHEN TARGET 0 string1 CALL WaitListS1
WHEN TARGET 1 string2 CALL WaitListS2
WHEN TARGET 2 string3 CALL WaitListS3

FOR loopControl = 1 UPTO maxTime
PAUSE 1
IF WaitListStat
RETURN
ENDIF
ENDFOR

;; Failure, never received any. Clear them all and exit.
WHEN TARGET 0 CLEAR
WHEN TARGET 1 CLEAR
WHEN TARGET 2 CLEAR

ENDPROC

PROC WaitListS1
WHEN TARGET 0 CLEAR
WHEN TARGET 1 CLEAR
WHEN TARGET 2 CLEAR
WaitListStat = 1
ENDPROC

PROC WaitListS2
WHEN TARGET 0 CLEAR
WHEN TARGET 1 CLEAR
WHEN TARGET 2 CLEAR
WaitListStat = 2
ENDPROC

PROC WaitListS3
WHEN TARGET 0 CLEAR
WHEN TARGET 1 CLEAR
WHEN TARGET 2 CLEAR
WaitListStat = 3
ENDPROC
;***************************************************************************
;PROC SampleUsage
; ;; Wait for one of two prompts. No third prompt, so passing in $NULLSTR
; WaitList(30, "enter to continue...", "press X to exit:", $NULLSTR)
; if WaitListStat == 1
; ;; got the "enter to continue..." prompt
; elseif WaitListStat == 2
; ;; got the "press X to exit:" prompt
; elseif WaitListStat == 3
; ;; this one can't happen. We passed in $NULLSTR
; elseif WaitListStat == 0
; ;; didn't find any of the prompts, timed out after 30 seconds
; endif
;ENDPROC
 
KNob,
I use VT100. I know how to change the color. This is a test script i was using to change the color.

proc main
WAITFOR "OP CLOCK" FOREVER
termwrites "^[[1;5;37;41m OP CLK"
termwrites "^[[1;32;40m ERROR"
while 1 ; Loop forever.
endwhile
endproc

Thanks Knob
 
OK, I think you've got most of what you need then. Add the STRIP keyword to all of the when target commands which will keep the string you are looking for from appearing in the terminal window. You would then want to modify the WaitListS1/WaitListS2/WaitListS3 procedures so that they have the termwrites strings to set the color, then termwrites the just-stripped string, and then a final termwrites to set the default text color back.

 
When I try to test this script before I even modify it I get this error.

________________________________________________________
ASPECT (tm) Script Compiler Version 4.8.0.71
Copyright © 1992-1999 Symantec Corporation. All Rights Reserved.

WAITLIST TEST.WAS:
Error C088 Line 80: Missing procedure MAIN
 
In your original post, you don't have a 'main' procedure. If that is what you are trying to run, then you need to include one.

As far as I know, you have to have a main procedure, even if it only points to another procedure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top