home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 9 / amigaformatcd09.iso / readerstuff / john_filsak / blank_line_manager next >
Encoding:
Text File  |  1996-11-13  |  2.1 KB  |  76 lines

  1. /*         Blank line manager 
  2.            ================== 
  3. Squeezes, stretches or removes blank lines
  4.  
  5.          Macro for FinalWriter
  6.          © 1996 John Filsak */
  7.  
  8. options results
  9. cr='0a'x
  10. para=1;true=1
  11. q='"';s=' '
  12.  
  13. showmessage 2 0 '"Blank line manager." "Do you want to delete" "or adjust blank lines?" "Delete" "Adjust" ""'
  14. del=result
  15. if del=1 then message=q||"Removing blank lines."||q||s||q||q||s||q||q||s||"OK"||s||"Cancel"||s||q||q
  16. if del=2 then do
  17.     showmessage 1 0 '"Blank line adjustment." "Do you have a style defined for this?" "" "Yes" "No" ""'
  18.     choice=result
  19.     if choice=1 then styleway=true
  20.     if styleway=true then do
  21.         requesttext '"Reformatting by style" "What is the name of your style?" "Para space"'
  22.         stylename=result
  23.         styletit=stylename||" style."
  24.         message=q||"Reformatting all blank lines using"||q||s||q||styletit||q||s||q||q||s||"OK"||s||"Cancel"||s||q||q
  25.     end
  26.     else do
  27.         requesttext '"Enter new size for your blank lines:" "Points" "8"'
  28.         lineheight=result
  29.         linetit=lineheight||" points."
  30.         message=q||"Resizing all blank lines to"||q||s||q||linetit||q||s||q||q||s||"OK"||s||"Cancel"||s||q||q
  31.     end
  32. end
  33. showmessage 1 0 message
  34. choice=result
  35. if choice=2 then exit
  36.  
  37. ctrldown;altdown  /*Go to bottom of text*/
  38. cursor down       /*and get number of paragraphs,*/
  39. ctrlup;altup      /*putting number in 'paras' variable*/
  40. status parapos
  41. parse var result paras rubbish
  42.  
  43. do while para<paras
  44.     movetopara para 0
  45.     extract
  46.     testchar=result
  47.     if testchar=cr then select
  48.         when del=1 then do
  49.             delete
  50.             paras=paras-1
  51.         end
  52.         when styleway=true then stylesheet stylename
  53.         otherwise do
  54.             cursor right
  55.             status spacing    /*This method mucks about with*/
  56.             spcing=result     /*the line spacing of the next*/
  57.             shiftdown         /*paragraph, so we find out what*/
  58.             cursor left       /*it is, and restore it at the*/
  59.             spacing variable  /*end of the routine.*/
  60.             leading lineheight
  61.             shiftup
  62.             movetopara para+1 0
  63.             spacing spcing
  64.         end
  65.     end
  66.     para=para+1
  67. end
  68. showmessage 1 0 '"All done!" "Thank you for using this macro." "© 1996 John Filsak" "OK" "" ""'
  69.  
  70. /*John Filsak
  71. 88 Cantrell Road
  72. Bulwell
  73. Nottingham
  74. NG6 9HJ
  75. 0115 976 3868*/
  76.