home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / dos / tools / aurora21 / longline.aml < prev    next >
Text File  |  1995-08-10  |  1KB  |  46 lines

  1. /* ------------------------------------------------------------------ */
  2. /* Macro:        LONGLINE.AML                                         */
  3. /* Written by:   nuText Systems                                       */
  4. /*                                                                    */
  5. /* Description:  This macro moves the cursor to the end of the        */
  6. /*               longest line in the current edit window.             */
  7. /*                                                                    */
  8. /* Usage:        Select this macro from the Macro List (on the Macro  */
  9. /*               menu), or run it from the macro picklist <shift f12> */
  10. /* ------------------------------------------------------------------ */
  11.  
  12.   // compile time macros and function definitions
  13.   include bootpath "define.aml"
  14.  
  15.   var maxlength
  16.  
  17.   // test for edit windows
  18.   if not wintype? "edit" then
  19.     msgbox "Edit windows only!"
  20.     return
  21.   end
  22.  
  23.   // make cursor position undo-able and goto file top
  24.   undocursor
  25.   row 1
  26.  
  27.   // do for all lines in the file
  28.   repeat
  29.  
  30.     // if the line length > current longest line..
  31.     if getlinelen > maxlength then
  32.  
  33.       // ..then make it the longest line and save the row
  34.       maxlength = getlinelen
  35.       longestline = getrow
  36.     end
  37.   until not down
  38.  
  39.   // goto to the end of the longest line
  40.   row longestline
  41.   col getlinelen + 1
  42.  
  43.   // use "onfound" (in EXT.AML) to adjust the window view if needed
  44.   send "onfound"
  45.  
  46.