home *** CD-ROM | disk | FTP | other *** search
/ TCE Demo 2 / TCE_DEMO_CD2.iso / demo_cd_.2 / mags / stosser / stoser12.arj / stoser12.msa / CUSTOM4 / SCANDIR.BAS (.txt)
Atari STOS Basic  |  1987-04-22  |  4KB  |  80 lines

  1. 10 REM Making a file selector : Part 1
  2. 100 REM                     |digits
  3. 110 REM auld Bastid 1993
  4. 120 REM 
  5. 130 UNKNOWN OP: 0x3A
  6. 140 REM 1st we have to reserve enough space to hold our filenames. Gem can't            handle as many as 300 files in a directory, BUT Neodesk can (actually           it can handle as many as you want, but 300 is fine)
  7. 150 UNKNOWN OP: 0x3A
  8. 160 DIM
  9. 170 UNKNOWN OP: 0x3A
  10. 180 GOSUB
  11. 190 UNKNOWN OP: 0x3A
  12. 20 REM Reading the Disk
  13. 200 IF
  14. 201 IF
  15. 210 FOR
  16. 220 PRINT
  17. 230 IF
  18. 240 NEXT
  19. 250 UNKNOWN OP: 0x3A
  20. 260 WAIT KEY
  21. 270 STOP
  22. 280 UNKNOWN OP: 0x3A
  23. 290 UNKNOWN OP: 0x3A
  24. 30 REM Subroutine 1 - Scans the disk,sorts the files alphabetically                                   then returns with the files names etc in:                                       F_BLOCK$() and the number of files in N_FILES,                                  subroutine also return FSELERR as -1 if too many files                          are in the directory.
  25. 300 REM SCAN DISK RETURNS F_BLOCK$(),N_FILES
  26. 31 REM  VARIABLES USED : F_BLOCK$(),FSELADD$,FSELT,N_FILES,                                              FSELTMP$,COUNFSELT,FSELERR
  27. 310 REM The Main Routine
  28. 320 UNKNOWN OP: 0x3A
  29. 330 REM SCAN DISK PATH
  30. 340 UNKNOWN OP: 0x3A
  31. 350 VARNAME
  32. 355 VARNAME
  33. 360 VARNAME
  34. 370 IF
  35. 380 WHILE
  36. 390 IF
  37. 40 REM 
  38. 400 UNKNOWN OP: 0x3A
  39. 410 REM fseladd$ holds the folder sorting character chr$(1) puts them at the top            chr$(255) put them at the bottom. By using other characters you can             order the files any way you fancy.
  40. 420 VARNAME
  41. 430 UNKNOWN OP: 0x3A
  42. 440 VARNAME
  43. 450 VARNAME
  44. 455 IF
  45. 460 VARNAME
  46. 470 WEND
  47. 480 UNKNOWN OP: 0x3A
  48. 490 REM *** SORT ALPHABETICALLY
  49. 50 REM MID$ positions:
  50. 500 UNKNOWN OP: 0x3A
  51. 510 SORT
  52. 520 UNKNOWN OP: 0x3A
  53. 530 REM STRIP OUT ADDITIONAL CHARS . It's now sorted so get rid of the                  characters we used for sorting.
  54. 540 UNKNOWN OP: 0x3A
  55. 550 FOR
  56. 560 UNKNOWN OP: 0x3A
  57. 570 REM FIND THE FIRST THAT ACTUALLY HOLDS INFO.                                        Because a null string ("") is less than all other things they come first        so we have to manually search down to find the first 'real' entry.
  58. 580 UNKNOWN OP: 0x3A
  59. 590 FOR
  60. 60 REM          1+12         14+8
  61. 600 IF
  62. 610 NEXT
  63. 620 UNKNOWN OP: 0x3A
  64. 630 REM MOVE THEM UP. Okay found it shuffle the entries up to the start.
  65. 640 UNKNOWN OP: 0x3A
  66. 650 VARNAME
  67. 660 FOR
  68. 670 VARNAME
  69. 680 NEXT
  70. 690 UNKNOWN OP: 0x3A
  71. 70 REM returns: PICB1.BAS    40987
  72. 700 REM NOW MAKE THE BLOCK TYPE I WANT. This file reconstructs the block to             include a marker character in position 1. This is so the user can see           that it's a folder and not a normal file. Any character can be used.            This section also removes unwanted information (date,time,type).
  73. 710 UNKNOWN OP: 0x3A
  74. 720 FOR
  75. 730 IF
  76. 740 NEXT
  77. 750 RETURN
  78. 80 REM          filename.ext|size
  79. 90 REM          12 chars    |upto 8
  80.