home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / wp_dtp / ispell.lha / Spell.ced < prev    next >
Text File  |  1991-02-08  |  2KB  |  100 lines

  1. /*  
  2.  *  Spell.ced ... ARexx Program to spell check a file while in CED!
  3.  *  Requires ISpell version 2.1ljr with ARexx Server mode.
  4.  *  Started: LJR  ?
  5.  *  Updated: LJR  12/26/89 1/10/90 1/23/90
  6.  *  Updated for CED v2.0: LJR  Tue Jan 23 04:22:16 1990
  7.  *  Last update: LJR  Thu Jun 14 20:07:46 1990
  8.  *  Copyright (C) 1990  Loren J. Ritte
  9.  *  Use as you will, just document your changes and keep my copyright
  10.  *  notice intact.
  11.  */
  12. options results
  13. status 21
  14. buffername = result
  15. errorname = buffername || '.err'
  16. whereclip = address() || 'where' || buffername
  17.  
  18. where = getclip(whereclip)
  19. if where ~== "" then do
  20.     if open('err', 'ram:$$'errorname,'r') = 0 then do
  21.         okay1 'Can''t open ram:errorfile!'
  22.         exit 0
  23.     end
  24.     seek('err', where, 'Begin')
  25.     word = readln('err')
  26.     if word = "" then do
  27.         close('err')
  28.         okay1 "No more errors were found!"
  29.         address command 'delete ram:$$'buffername 'ram:$$'errorname
  30.         setclip(whereclip)
  31.         exit 0
  32.     end
  33.  
  34.     address 'IRexxSpell' check word
  35.     line = result
  36.     parse var word '&' choices
  37.  
  38.     search for... word 0 0 1 1
  39.     if choices =  "" then
  40.         okay1 "Nothing good found for" word||"."
  41.     else
  42.         okay1 "Try"||choices||"0a"x||"in place of" word||"."
  43.     where = seek('err', 0, 'Current')
  44.     call setclip whereclip, where
  45.     close('err')
  46.  
  47.     exit (0)
  48. end
  49.  
  50. if pos('IRexxSpell',(show(ports))) = 0 then do
  51.     address command 'runback ispell -r >null: <null:'
  52.     address command waitforport 'IRexxSpell'
  53. end
  54. beg of file
  55. mark block
  56. 'end of file'
  57. copy block
  58. 'save block to file...' "ram:$$"buffername
  59. mark block
  60. left
  61. copy block
  62. beg of file
  63.  
  64. address 'IRexxSpell' filecheck "ram:$$"buffername
  65. r = result
  66. if pos('Error', r) ~= 0 then do
  67.     okay1 'ISpell' r
  68. end
  69.  
  70. address command copy r "ram:$$"errorname
  71. address command delete r
  72. if open('err', 'ram:$$'errorname,'r') = 0 then do
  73.     okay1 'Can''t open ram:errorfile!'
  74.     exit 0
  75. end
  76.  
  77. word = readln('err')
  78. if word = "" then do
  79.     close('err')
  80.     okay1 "No errors were found!"
  81.     address command 'delete ram:$$'buffername 'ram:$$'errorname
  82.     setclip(whereclip)
  83.     exit 0
  84. end
  85.  
  86. address 'IRexxSpell' check word
  87. line = result
  88. parse var word '&' choices
  89.  
  90. search for... word 0 0 1 1
  91. if choices =  "" then
  92. okay1 "Nothing good found for" word||"."
  93. else
  94. okay1 "Try"||choices||"0a"x||"in place of" word||"."
  95.  
  96. where = seek('err', 0, 'Current')
  97. call setclip whereclip, where
  98. close('where')
  99. close('err')
  100.