home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / CDRom / PET-CDW2.DMS / in.adf / rexx / SortBlock.ced < prev    next >
Encoding:
Text File  |  1993-07-07  |  1.6 KB  |  70 lines

  1. /*
  2. ** SortBlock.ced
  3. **
  4. ** $VER: SortBlock.ced 1.0.0 (2.6.93)
  5. **
  6. ** This script is designed to execute from a window within CED to
  7. ** sort the highlighted area (in a block) alphabetically.  It works similar
  8. ** to the built-in functions Rot Marked and Change Case Marked.  You specify
  9. ** an area, then call this function.
  10. **
  11. ** Note:
  12. ** 1. The 'Sort' command must be present in your command path in order for
  13. **       this program to run.
  14. ** 2. This program works with temporary files in T:, so you might want to
  15. **       modify it to store instead on a more appropriate device.
  16. **
  17. ** This script requires CygnusEd Professional v3.5 (or later) to run.
  18. **
  19. ** Copyright © 1990-1993 ASDG, Incorporated  All Rights Reserved
  20. */
  21.  
  22.  
  23. TempUnsortedBlock = "T:TempUnsortedBlock"
  24. TempSortedBlock = "T:TempSortedBlock"
  25.  
  26.  
  27. ADDRESS "rexx_ced"
  28. OPTIONS RESULTS
  29.  
  30.  
  31. CUT                        /* Cut the original block out */
  32. IF (RESULT ~= 0) THEN DO            /* If the user did in fact have a block specified, then... */
  33.     /*
  34.     ** Store block in a temporary file.
  35.     */
  36.     SAVE CLIP AS TempUnsortedBlock
  37.  
  38.     /*
  39.     ** Tell the CLI to sort the newly created file
  40.     */
  41.     ADDRESS COMMAND "Sort" TempUnsortedBlock TempSortedBlock
  42.  
  43.     /*
  44.     ** Tell CygnusEd to include the newly sorted file
  45.     */
  46.     ADDRESS "rexx_ced" INCLUDE FILE TempSortedBlock
  47.  
  48.     /*
  49.     ** This STATUS command will ensure that CED finishes loading the
  50.     ** sorted file before ARexx sends off the command to delete the
  51.     ** file.
  52.     */
  53.     STATUS RESTNAME
  54.  
  55.     /*
  56.     ** Delete the temporary files.
  57.     */
  58.     ADDRESS COMMAND "Delete" TempUnsortedBlock
  59.     ADDRESS COMMAND "Delete" TempSortedBlock
  60. END
  61. ELSE DO
  62.     /*
  63.     ** No block was marked.
  64.     */
  65.     CEDTOFRONT
  66.     OKAY1 "Can't sort block.  No block was marked."
  67. END
  68.  
  69. EXIT 0
  70.