The following is a macro that you can try.  It will prompt you so you can change what you want to group.

Note that if the user command starts with # you will have to type untill you include the equal sign.

 

STRING:#tmpstr
STRING:#tmpstr2
integer:#elno
integer:#eof_flag
STRING:#text
STRING:#file
//  the next line is the var for the text to find
#text=STRTMP("#BLKDEL=1")
PROMPT[TX="Find all user commands\n
that start with", VN="text", LR=15,LC=15]

 

NEW_GRP[]
FILTER[PT=0, HL=0, LN=0, AR=0, PL=0, SP=0, EL=0, HX=0, TX=0,
    UC=1, TD=0, GV=0, LY=0, ST=0, WP=0]
FILTER_USE[ON=1]
GRP_FILT_ADD[]
FILTER_USE[ON=0]
 IF(GRP(0)>0)
  AUTO_ANSWER[AA="YES"]
  DUMP_LST[GP=1,
OM=1, FN="C:\USERLIST.TXT"]
  AUTO_ANSWER[AA="OFF"]
 ENDIF
NEW_GRP[]
#file="c:\USERlist.txt"
F_CLOSE[FN=STRTMP("%file")]
F_OPEN[FN=STRTMP("%file"), TY="R"]

 

F_READ[FN=STRTMP("%file"), FMT="%S", VR="tmpstr"]
F_READ[FN=STRTMP("%file"), FMT="%S", VR="tmpstr"]
#eof_flag=F_EOF(#file)

 

WHILE (#eof_flag=0)
 F_READ[FN=STRTMP("%file"), FMT="%S", VR="tmpstr"]
 IF(STREQUAL(STRSUB(#tmpstr,1,3),"El.")=1)
  #elno=STRSUB(#tmpstr,7,4)
  //PAUSE[TX=STRTMP("element %elno"),PT=1]
  F_READ[FN=STRTMP("%file"), FMT="%S", VR="tmpstr"]
  F_READ[FN=STRTMP("%file"), FMT="%S", VR="tmpstr"]
  F_READ[FN=STRTMP("%file"), FMT="%S", VR="tmpstr"]
  F_READ[FN=STRTMP("%file"), FMT="%S", VR="tmpstr"]
  F_READ[FN=STRTMP("%file"), FMT="%S", VR="tmpstr"]

 


   IF(STRLEN(#tmpstr)>5+STRLEN(#text))
   #tmpstr2=STRSUB(#tmpstr,7,STRLEN(#text))
   //PAUSE[TX=STRTMP("%tmpstr"),PT=1]
   //PAUSE[TX=STRTMP("%tmpstr2"),PT=1]

 

   IF(STREQUAL(#tmpstr2,#text)=1)
    //PAUSE[TX=STRTMP("FOUND %tmpstr2 element %elno"),PT=1]
    ELMT_GRP[AR=0, EL=#elno]
   ENDIF

 

  ENDIF
 ENDIF
 #eof_flag=F_EOF(#file)

 

ENDW
F_CLOSE[FN=STRTMP("%file")]
// uncomment the next line when you have the logic proved out
// or you can pick group delete after running the macro
//GRP_DELETE[]

 

@END

 

 

 

I hope this helps

Tony

Reply via email to