| No need for you to write a UDP.... I have one already!!
Is it quick - NO.
Does it work - Probably!! :-)
It searches your File Cabinet (its best to specify a folder to limit
the search) and finds all messages sent TO or CC to someone.... that is
not just the ones you have sent, but ones other people might have sent
that you also have a copy of...
It puts the results in your scratch pad.....
!FC_TO_WHO
! Searches the whole File Cabinet, looking for all memos addressed (TO and
! CC) to a particular user....
! THIS IS NOT QUICK TO RUN!!
!
!
.FX PROMPT "Enter Name (or location) to search for: "
.IF OA$PROMPT_DISPOSE EQS 0 THEN .GOTO END
.IF OA$PROMPT_TEXT EQS "" THEN .GOTO END
.FX GET #USER = OA$PROMPT_TEXT
.FX PROMPT "Enter folder, or <RETURN> for all folders: "
.IF OA$PROMPT_DISPOSE EQS 0 THEN .GOTO END
.IF OA$PROMPT_TEXT EQS "" THEN .GOTO ALL_FOLDERS
!
! Open the scratch pad for writing...
!
.FX TEXT_FILE OPEN/WRITE #FILE "paste.tmp"
.FX GET #LINE = " FOLDER TITLE" -
" DOCNUM CREATED"
.FX TEXT_FILE WRITE #FILE #LINE
.FX GET OA$FUNCTION = "DISPLAY Searching " OA$PROMPT_TEXT " folders. " -
" Could take some time! . . . "
.FX FORCE
.FX GET #A = 0
!
! Now for the major loop...
!
! Can make this search quicker by only searching a few folders...
! (N.B. saying .FOLDER = "gas" says search for all folders that
! START WITH gas),
! Also can make the final list shorter, by only searching for mail messages
! that you have sent...
! Do this by replacing the next (non-commented) line with various
! others Like:
! .FX FOR CAB$ WITH .FOLDER = "gas" DO -
! .FX FOR CAB$ WITH .MAIL_STATUS = "SENT" DO -
! .FX FOR CAB$ WITH .FOLDER = "gas" AND .MAIL_STATUS = "SENT" DO -
!.FX FOR CAB$ DO -
!
.FX FOR CAB$ WITH .FOLDER = OA$PROMPT_TEXT DO -
GET #LINE = .FOLDER:27 " " .TITLE:30 " " .DOCNUM " " .CREATED:11 \\ -
FOR FIRST CAB$ATTRIBUTES:"TO" WITH .VALUE <=> #USER DO -
GET #A = 1 \\ -
FOR FIRST CAB$ATTRIBUTES:"CC" WITH .VALUE <=> #USER DO -
GET #A = 1 \\ -
.IF #A = 1 THEN TEXT_FILE WRITE #FILE #LINE \\ -
GET #A = 0
!
! The above lines look through the required section of the File Cabinet.
! For each document it saves the details (folder, title etc).
! Then it looks through the TO and CC to see if we need this document.
! If so, it writes it out to the file...
!
! Again it could be speeded up by removing the lines:
! FOR FIRST CAB$ATTRIBUTES:"CC" WITH .VALUE <=> OA$PROMPT_TEXT DO -
! GET #A = 1 \\ -
!
!
! Having done all the search, display the scratch pad to the user...
!
.FX TEXT_FILE CLOSE #FILE
.FX LIST PASTE.TMP
.FX DISPLAY The list of documents is in your Scratch Pad
.GOTO END
.LABEL ALL_FOLDERS
.FX YESNO_PROMPT "This could take some time, are you sure [Y/N]? "
.IF OA$PROMPT_TEXT = "Y" THEN .GOTO OK
.GOTO END
.LABEL OK
.FX FOR CAB$ DO -
GET #LINE = .FOLDER:27 " " .TITLE:30 " " .DOCNUM " " .CREATED:11 \\ -
FOR FIRST CAB$ATTRIBUTES:"TO" WITH .VALUE <=> #USER DO -
GET #A = 1 \\ -
FOR FIRST CAB$ATTRIBUTES:"CC" WITH .VALUE <=> #USER DO -
GET #A = 1 \\ -
.IF #A = 1 THEN TEXT_FILE WRITE #FILE #LINE \\ -
GET #A = 0
!
! Having done all the search, display the scratch pad to the user...
!
.FX TEXT_FILE CLOSE #FILE
.FX LIST PASTE.TMP
.FX DISPLAY The list of documents is in your Scratch Pad
.GOTO END
.LABEL END
.FX OA$FLD_STAY
.EXIT
|