home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / text / FDB-Data / Search.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1995-10-12  |  3.0 KB  |  108 lines

  1. /*  ARexx-Script
  2.     for Using FDB databases and their archives (Meeting Pearls III)
  3.     $VER: FDB.rexx 1.1 (12.10.95)
  4.     ©1995 Khamsonh Marcel Khounlivong
  5.  
  6.     Requirements:   FDB bye Klaus Melchior
  7.                     ReqList bye Khamsonh Marcel Khounlivong (on CD)
  8.                     ARexx
  9.                     RexxReqTools (and ReqTools) libraries by Nico François
  10.  
  11.     */
  12.  
  13. OPTIONS RESULTS
  14.  
  15. enter = '0a'x
  16. AssignFile = 'T:FDB_AssignFile'
  17. ResultFile = 'T:FDB_Result'
  18.  
  19. CALL AddLib('rexxsupport.library',5,-30)
  20. CALL AddLib('rexxreqtools.library',5,-30)
  21.  
  22. ADDRESS command 'Assign EXISTS >'AssignFile' FindDB:'
  23. IF (RC ~= 0) THEN DO
  24.     error = 'Kein Assign "FindDB:"'enter'Missing assign "FindDB:"'
  25.     CALL error_exit
  26.     END
  27.  
  28. IF (~Open(inassign,AssignFile,r)) THEN DO
  29.     error = 'Can''t open'enter'"'AssignFile'"'
  30.     CALL error_exit
  31.     END
  32.  
  33. AssignList = ''
  34. DO FOREVER
  35.     dir = ReadLn(inassign)
  36.     IF Eof(inassign) THEN BREAK
  37.  
  38.     dir = SubStr(dir,WordIndex(dir,2))
  39.     IF (Right(dir,1) ~= ':') THEN dir = dir'/'
  40.     AssignList = AssignList dir
  41.  
  42.     ADDRESS command 'List >>T:FDB_codes2 'dir'#?.(codes|.codes.lha)#? LFORMAT "%n"'
  43.     END
  44. CALL Close(inassign)
  45.  
  46. ADDRESS command 'Sort T:FDB_codes2 T:FDB_codes'
  47. ADDRESS command 'ReqList VERBOSE CLONERT PAGE=5',
  48.     'INPUT=T:FDB_codes',
  49.     'OUTPUT='ResultFile,
  50.     'LIST=T:FDB_codes',
  51.     'HEADER="Nutze FDB-Datenbasis...\nuse FDB database..."'
  52. IF (RC == 5) THEN CALL clean_exit
  53.  
  54. IF (~Open(inresult,ResultFile,r)) THEN DO
  55.     error = 'Can''t open'enter'"'ResultFile'"'
  56.     CALL error_exit
  57.     END
  58. Choice = ReadLn(inresult)
  59. CALL Close(inresult)
  60.  
  61. SELECT
  62.     WHEN (UPPER(Right(Choice,6)) == '.CODES') THEN DO
  63.         DBChoice = SubStr(Choice,1,Length(Choice)-6)
  64.         CALL fdb_ask
  65.         END
  66.     WHEN (UPPER(Right(Choice,10)) == '.CODES.LHA') THEN DO
  67.  
  68.         Target = rtgetstring('T:','"'Choice'"'enter'entpacken nach ...'enter'unarchive to ...',,
  69.             'Lha -q x' Choice '...',
  70.             ,,,okay)
  71.         IF (okay == 0) THEN CALL clean_exit
  72.         IF (Right(Target,1) ~= ':') THEN Target = Strip(target,t,'/')'/'
  73.  
  74.         ADDRESS command 'LhA -q x FindDB:'Choice Target
  75.         DBChoice = SubStr(Choice,1,Length(Choice)-10)
  76.  
  77.         IF (~Find(Target,AssignList)) THEN
  78.             ADDRESS command 'Assign ADD FindDB:' Target
  79.  
  80.         CALL fdb_ask
  81.  
  82.         IF (~Find(Target,AssignList)) THEN
  83.             ADDRESS command 'Assign REMOVE FindDB:' Target
  84.         ADDRESS command 'Delete QUIET' Target || DBChoice'.codes'
  85.  
  86.         END
  87.     OTHERWISE NOP
  88.     END
  89. CALL clean_exit
  90.  
  91. error_exit:
  92.     CALL rtezrequest(error,,,
  93.         'Error detected :-(','rtez_flags=ezreqf_centertext')
  94. clean_exit:
  95.     ADDRESS command 'Delete QUIET T:FDB_#? T:#?.codes'
  96.     EXIT
  97.  
  98. fdb_ask:
  99.     DBFind = rtgetstring(,'Pattern für Suchbegriff:'enter'Search pattern:'enter'(#? not neccessary)',,
  100.         'FDB DB='DBChoice '...',
  101.         ,,,okay)
  102.     IF (okay == 0) THEN CALL clean_exit
  103.  
  104.     ADDRESS command 'FDB >T:FDB_codes DB='DBChoice DBFind
  105.     ADDRESS command 'MetaTool T:FDB_codes TEXT'
  106.     RETURN
  107.  
  108.