home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / opus / v4 / sortdopus / dopus / arexx / sortdopus.dopus
Text File  |  1996-09-03  |  2KB  |  92 lines

  1. /*
  2. Short:        Select sort method/direction for DOpus4
  3. Uploader:     Dave Clarke <4wd@connexus.apana.org.au>
  4. Author:       Dave Clarke <4wd@connexus.apana.org.au>
  5. Type:         biz/dopus
  6. Version:      1.0
  7. Distribution: Aminet
  8.  
  9. $VER: SortDOpus.dopus V1.0 (13.4.94)
  10.  
  11. Script to change the sort item and direction in DirOpus. V4.11
  12.  
  13. (Only operates on the active window)
  14.  
  15. You can sort on: Name, Size, Protection flags, Date, File comment, Filetype.
  16. And also in the reverse direction, (Z->A).
  17.  
  18.  
  19. Installation:  Create the amount of buttons/menuitems you need
  20. with the following options.
  21.  
  22. ARexx   SortDOpus.dopus {type} [{direct}]
  23.  
  24. Flags.. Run Asynchronously
  25.  
  26. where: {type} = sort item -> N = Name
  27.                              S = Size
  28.                              P = Protection flags
  29.                              D = Date
  30.                              C = File comment
  31.                              F = Filetype
  32.        {direct} = Direction -> R = Reverse
  33.                                Anything else is normal, (eg. A->Z)
  34.  
  35. eg. SortDOpus.dopus P R will sort on protection flags in reverse order.
  36.  
  37. */
  38.  
  39. trace off
  40. options results
  41. signal on error
  42.  
  43. parse arg type direct .
  44. address 'DOPUS.1'
  45. 'status 3'
  46. A_Win=RESULT
  47. 'query sortflags'
  48. S_Flag=RESULT
  49.  
  50. if direct='R' then do
  51.   N_Flag=c2d(bitset(d2c(S_Flag),A_Win))
  52.   dir='Reverse'
  53.   end
  54. else do
  55.   N_Flag=c2d(bitclr(d2c(S_Flag),A_Win))
  56.   dir='Normal'
  57.   end
  58.  
  59. 'modify sortflags 'N_Flag
  60.  
  61. select
  62. when type='N' then do
  63.   'modify sortmethod -1 0'
  64.   topline='Name'
  65.   end
  66. when type='S' then do
  67.   'modify sortmethod -1 1'
  68.   topline='Size'
  69.   end
  70. when type='P' then do
  71.   'modify sortmethod -1 2'
  72.   topline='Protection'
  73.   end
  74. when type='D' then do
  75.   'modify sortmethod -1 3'
  76.   topline='Date'
  77.   end
  78. when type='C' then do
  79.   'modify sortmethod -1 4'
  80.   topline='Comment'
  81.   end
  82. when type='F' then do
  83.   'modify sortmethod -1 5'
  84.   topline='Filetype'
  85.   end
  86. otherwise
  87. end
  88.  
  89. rescan
  90. toptext dir topline
  91. exit 0
  92.