SeeView Manual

Sample Script
HP NonStop SeeView Manual526355-004
C-5
{
{ If no files marked, do a INFO <file>,DETAIL on the passed PARM #file.
{----------------------------------------------------------------------}
PARM #file; { file pointed to.
VAR menuline1 := #menucacheline { first cache line in file menu
, row { n-th cache line in file menu
,#opfile { File marked with #op
,#op { operation to do on #file
,#lastop { last operation done on #file
,#rule { if #op in MyMenu then command
,#prompt { if #op in MyMenu then prompt
,#response { if #prompt then response to it
, WaitForOp { if #op in MyMenu then WaitForOp
, eof { end of file flag
,#s { scratch string
,#z { scratch string
, i { scratch integer
, fkrow:= #FKEYLINE { cursor row
, fkcol:= #FKEYCOL { cursor column
;
DELETE fup!; PUSH "-" ONTO fup; { cleanup fup cache.
DELETE scratch!; { cleanup accept cache.
LINE #MENULINE,#MENUCOL; { position on "files" menu
ACCEPT INTO scratch; { accept "files" marks.
row := 0; { row in accept cache.
DO BEGIN { Read each row
READ scratch CACHE row, #s, eof; { in accepted cache.
#op := #TAKE #s; { #op is mark for this row.
IF #op<>"" THEN BEGIN { Have a mark for this row.
READ files CACHE menuline1 + row,#z; { Read Files cache to get
#opfile := #TAKE #z; { name of file for this
IF #opfile<>"" THEN BEGIN { marked row (#opfile).
#z := #op & " =>"; { Search for mark #z in
SEARCH MyMenu CACHE - #z { cache. And if line found
LINEFOUND #rule; { #rule will contain line.
IF #rule="" THEN BEGIN { if #rule="" unknown mark
MSG (r) "This mark is an unknown command=" & #op;
RETURN;
END;
{ mark found, pickup the various rules for this command
#prompt:= #rule[ 60:132 ]; { Prompt rule (if any)
waitForOp := 1; { Wait for response, or
IF #rule[5]="." THEN WaitForOp:=0; { . implies don't wait.
#rule := #rule[(#SIZE #z)+2: 59 ]; { #rule = Command Template
{parse #rule to see if command requires a prompt
SCAN #rule until "#" -> i;
IF i THEN BEGIN { Rule requires prompt.
IF #response="" OR { If haven't prompted before
(#lastop<>"" AND #op<>#lastop) { or, different operation
THEN BEGIN { prompt user for info.
CALL ask ( #prompt ); { Do waited dialogue box.
CURSOR fkrow,fkcol; { Put cursor back.
IF #parm="" THEN BEGIN { if no input then
MSG "Escape."; { escape.
RETURN;
END;
#response := #parm; { save prompt #response
END;
#rule := #rule[1:i-1] { fold response into command
& #response { at prompt insertion point.
& #rule[i+1:132];
END;