home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d6xx / d645 / dmd.lha / DMD / REXX / FindReq.dme < prev    next >
Text File  |  1992-04-26  |  2KB  |  77 lines

  1. /* FindReq.dme © 1992 Fergus Duniho */
  2. /* Requester for Find, Find & Replace, Set Find and Replace Strings */
  3.  
  4. F = GetEnv('F')
  5. R = GetEnv('R')
  6. CASE = Overlay(Upper(GetEnv('CASE')),'     ',2)
  7. N = -1
  8.  
  9. Address AREXX '"Call CreateHost CPORT, NOTPORT"'
  10. Do Until ShowList(P,CPORT)
  11.     Call Delay(10)
  12. End
  13.  
  14. IDCMP = 'WINDOWDRAG+GADGETUP+CLOSEWINDOW'
  15. FLAGS = 'ACTIVATE+WINDOWDRAG+WINDOWCLOSE'
  16.  
  17. Call OpenWindow CPORT, 50, 25, 500, 90, IDCMP, FLAGS, 'DMD Find Requester © 1992 Fergus Duniho'
  18.  
  19. Call SetReqColor CPORT, OKAYPEN, 1
  20. Call SetDrMd CPORT, COMPLEMENT
  21. Call Move CPORT, 20, 22
  22. Call Text CPORT, 'Find String    : '
  23. Call AddGadget CPORT, 155, 14, 'F', F, 'F = "(%g)"; Call ActivateGadget CPORT, "R"', 300
  24.  
  25. Call Move CPORT, 20, 42
  26. Call Text CPORT, 'Replace String : '
  27. Call AddGadget CPORT, 155, 34, 'R', R, 'R = "(%g)"; Call ActivateGadget CPORT, "N"', 300
  28.  
  29. Call Move CPORT, 20, 62
  30. Call Text CPORT, 'Replacements   : '
  31. Call AddGadget CPORT, 155, 54, 'N', N, 'N = "%g"', 50
  32.  
  33. Call Move CPORT, 230, 62
  34. Call Text CPORT, 'Ignore Case : '
  35. Call AddGadget CPORT, 350, 54, 'Case', Case, 'Call ICase'
  36.  
  37. Call AddGadget CPORT, 50, 74, 'find', ' Find ', 'Call Set; next; Exit'
  38. Call AddGadget CPORT, 150, 74, 'replace', ' Replace ', 'Call Set; C="repeat" N "nextr"; C; Exit'
  39. Call AddGadget CPORT, 280, 74, 'set', ' Set ', 'Call Set; Exit'
  40. Call AddGadget CPORT, 380, 74, 'cancel', ' Cancel ', 'Call Quit CPORT; Exit'
  41. Call ModifyHost CPORT, CLOSEWINDOW, 'Call Quit CPORT; Exit'
  42.  
  43. Call ActivateGadget CPORT, 'F'
  44.  
  45. Call OpenPort MAINPORT
  46. Do Until ShowList(P, MAINPORT)
  47.     Call Delay(10)
  48. End
  49.  
  50. Call SetNotify(CPORT, GADGETUP, MAINPORT)
  51. Call SetNotify(CPORT, CLOSEWINDOW, MAINPORT)
  52.  
  53. Do Forever
  54.     Call WaitPkt(MAINPORT)
  55.     PACKET = GetPkt(MAINPORT)
  56.     If PACKET ~== Null() Then Interpret GetArg(packet, 0)
  57. End
  58.  
  59. ICase:
  60.     Call SetGadget CPORT, 'Case', on
  61.     Call RefreshGadgets CPORT
  62.     Call RemoveGadget CPORT, 'Case'
  63.     If CASE = ' ON  ' Then CASE = ' OFF '
  64.                       Else CASE = ' ON  '
  65.     Call AddGadget CPORT, 350, 54, 'Case', CASE, 'Call ICase()'
  66. Return
  67.  
  68. Set:
  69.     Call Quit CPORT
  70.     findstr F
  71.     repstr R
  72.     CASE = Compress(CASE)
  73.     ignorecase CASE
  74.     C = 'setenv Case' CASE 'setenv F' F 'setenv R' R
  75.     C
  76. Return
  77.