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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Cr at "More..." until there are no more pages

Status
Not open for further replies.

DMS500Tech

Technical User
Dec 22, 2004
39
US
Guys I am stumped.
I am gathering alarms from equipment. There is no way to get it to scroll continously. It displays about 9 entries then displays a "More..." above a right caret ">" . Because I never know how many pages there will be I can't hard code so many carriage returns without pages of garbage when there are few or no alarms.
I know this is a simple IF or While statement.

here is a sample of the data:

34 SPE MS1 HEM 12-1 HEM Facility Fail clear
Cleared: 20:14:40 07/04/2006
33 SPE MS1 CP 16 Minimum Upstream Protection Band Limit clear
Cleared: 20:14:40 07/04/2006
34 SPE MS1 HEM 12-1 HEM Facility Fail m,SA
Raised: 20:14:15 07/04/2006
33 SPE MS1 CP 16 Minimum Upstream Protection Band Limit m,nsa
Raised: 20:14:03 07/04/2006
32 SPE MS1 CP 16 Minimum Upstream Protection Band Limit clear
Cleared: 20:10:40 07/04/2006
32 SPE MS1 CP 16 Minimum Upstream Protection Band Limit m,nsa
Raised: 20:10:23 07/04/2006
More...
>

The help is needed in writing a loop that will look for the "More..." (line 23) and send a "^M" at the right caret ">" (line 24) below it and keep doing it until the right caret ">" appears without the "More..." above it or keep sending "^M" until "CVALRM CI:" (line 23) appears above the right caret ">".

CVALRM CI:
>

I have already looked thru Tek-Tips past and looked thru aspectscripting.com that Knob always suggest and did not come across anything that I thought would help. This seems like it would be a simple task and I have been using Aspect for over a decade I just can't figure this one out. In the past I have always been able to use a simple "waitfor" and got by just fine but since what is being searched for is not at the prompt figuring out how to use "termgets" from the one sample in Aspect is not enough.

(One more thing, this script goes into 74 different machines and the alarms very from none to 20 or more pages)
This script is almost a 1000 lines long and this is the only part that does not work.

Thanks for any suggestions.
 
I have a script that someone sent me ages ago that is made for cases like this. You can find it here:


You would tell it to look for the two strings of interest, I would say in this order "More..." and "CVALRM CI:". Place the call to the script inside a while 1 loop. After the script has received one of the two prompts, it will return from the appropriate procedure and have a number in the WaitListStat variable. If it is 1, do nothing so the while loop runs again and the script keeps looking at the prompts. If the value of WaitListStat is 2, use exitwhile to exit the while loop so the WaitList procedure is not called anymore. Below is the original WaitList procedure modified to work as above:

; 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
while 1
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
if WaitListStat == 1
exitwhile
endif
endwhile
ENDPROC

 
Okay knob this is a whole new area for me. I have spent many hours debugging and have reached an impass. can you look and see what I have done with what you suggested and maybe tell me why I can't get past "Error C081 line 985;Invalid number of arguments" Line 985 is the first line below "Call WaitList"

call WaitList

pause 4
transmit "quit all;logout^M"
waitfor "Press return to exit." forever
transmit "^M"
EndProc
;*********************************************************************

PROC WaitList

;**********************************************************************
; 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
;***********************************************************************
PARAM INTEGER maxTime
PARAM STRING more,CVALRM

INTEGER waitliststat ;Global var for WaitList() procedure
INTEGER loopControl
MaxTime = 40

#IFDEF ASPDEBUG
STRFMT S0 "WaitList on `"%s`" `"%s`"" more CVALRM
#ENDIF
while 1
WaitListStat = 0

WHEN TARGET 0 more CALL WaitListS1
WHEN TARGET 1 CVALRM CALL WaitListS2

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
if WaitListStat == 1
exitwhile
endif
endwhile
ENDPROC

Proc WaitListS1
transmit "^M"
EndProc

Proc WaitListS2
transmit "quit"
EndProc

Proc WaitListS3
return
EndProc
 
I think this is your problem:

Code:
   PARAM INTEGER  maxTime
   PARAM STRING   string1, string2, string3

call waitlist should be passing some data (you're maxTime, and 3 strings.)

See the sample usage code commented at the bottom of Knob's link. In his example, waitlist is called like this:

Code:
WaitList(30, "enter to continue...", "press X to exit:", $NULLSTR)
 
Sorry, incomplete post above.. My bad.

In your example, you are using two strings, (more, CVALRM.)

When you envoke waitlist, it should be something like this:

Code:
waitlist(30,"More...", "CVALRM CI:")

You may have to include a 3rd string ($NULLSTR) and define a string for it in your PARAM String line. (PARAM String more,CVALRM, string3)

I'm not sure if the $NULLSTR is required or not, try it both way's.
 
Yes, try $NULLSTR - think there is an example call with that from the person I received the script from ages ago. That's saved my bacon more times than I can count when you have to look for two or three different results to a command.

 
All right I feel like a fool now. Thank you kodr for pointing out my mistake. I completely misunderstood knob in the first response. I did not relize that what was needed was a loop for the call and then pass the varibles to the called process.
I have re-written the calling proceedure the way I think it should be but I am still getting the error INVALID NUMBER OF ARGUMENTS and MISMATCHED ARGUMENT TYPE on the line in the while loop that is calling WaitList with ().
Again this is a new area for me and the help files don't give a very good example.

Proc AlarmReport

integer MaxTime
string String1, String2, String3
integer WaitListStat

WaitListStat = 1
MaxTime = 50
string1 = "more"
string2 = "CVALRM CI:"
string3 = $NULLSTR

transmit "date^M"
waitfor ">" forever
transmit "^M"
transmit "cvalrm;history sp^M"

;while loop
while WaitListStat = 1
call WaitList with (maxtime,"String1","String2","String3")
endwhile

transmit "quit^M"
pause 1
transmit "quit all;logout^M"
waitfor "Press return to exit." forever
transmit "^M"
EndProc
;*********************************************************************

; 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
while 1
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
if WaitListStat == 1
exitwhile
endif
endwhile
ENDPROC

Proc WaitListS1
WaitListStat = 1
Endproc

Proc WaitListS2
WaitListStat = 2
EndProc

Proc WaitListS3
WaitListStat = 3
EndProc
 
call WaitList with (maxtime,"String1","String2","String3")

Should be:

Code:
call Waitlist with (maxtime, string1, string2, string3)

By passing "String1" you are literally passing the 7 character string "String1" not the contents of your String1 variable.
 
That makes sence. I tried removing the quotes and recompiled but still get the same errors INVALID NUMBER OF ARGUMENTS AND MISMATCHED ARGUMENT TYPE and I don't get it. It looks like the 4 varibles have been declared, passed, and received exactly alike.
any other suggestions?
 
Yeah, below is my test..

This code fails for the same error you get:

Code:
call waitlist with (maxtime,string1,string2,string3)

This works:

Code:
waitlist(maxtime,string1,string2,string3)
 
Well you are not going to believe this but I could not get it to work without the "with" so I went back to the sample in the help files and noticed that they did not have a left and right paren so I removed them and recompiled once more and this time it compiled clean.

call WaitList with maxtime, String1, String2, String3

THANK YOU KNOB AND KODR
you both provide a valuble service to those of us trying to hack our way thru aspect.

Have you ever thought about compliling all these great dialogs into a book or PDF that could be searchable?
 
Not me, I'm just stumbling through this stuff blindly.
 
I try to put what I consider my "better" scripts on my site with extra verbiage if needed. I've also noticed in the past that Google searchs Tek-Tips pretty well (it's how I found this site in the first place), so I think most of the information on here can be searched in that way (I've seen Tek-Tips on internal search more hit or miss in my opinion).


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top