home *** CD-ROM | disk | FTP | other *** search
- ' ┌─────────────────────────────────────────────────────────────────────┐
- ' │ This Quick Library is for Basic PDS 7 │
- ' └─────────────────────────────────────────────────────────────────────┘
- ' ┌─────────────────────────────────────────────────────────────────────┐
- ' │ │
- ' │ These Routines are for MS dos Systems and do not use Interrupts. │
- ' │ │
- ' │ If you like the Functions you can order the OBJ module an the │
- ' │ Library LIB module for $7.00 . │
- ' │ │
- ' │ To Register send $7.00 with your name and address to: │
- ' │ │
- ' │ ATTEN: SubDirectory program │
- ' │ Scott Roepenack │
- ' │ 3760 Secor road │
- ' │ South Venice, Fl. 34293 │
- ' │ │
- ' │ │
- ' │ All comments welcome! │
- ' │ │
- ' │ │
- ' │ Program info: │
- ' │ │
- ' │ Both Functions make a temp file in the current directory │
- ' │ called DIR920A.TMP, file is killed after use... │
- ' │ │
- ' │ │
- ' │ SUBDIR1$ is for programs that will be run on dos 4.01 or earlyer │
- ' │ It does not sort the directorys found. │
- ' │ │
- ' │ SUBDIR5$ is for programs on Dos 5.0 only │
- ' │ It sorts Directorys found and is much faster than SUBDIR1$ but │
- ' │ it will only work on dos 5.0. │
- ' │ │
- ' │ Do not use Direc$() Directly... │
- ' │ It is Intialize every time its called, to null$ for STATIC and │
- ' │ deallocates the array and frees memory for DYNAMIC programs. │
- ' │ │
- ' │ You can use 'MaxCount' to get the Maximum number of Directorys │
- ' │ found 'EndDirectory' returns 1 if not End of Directorys and -1 │
- ' │ if End of directory. │
- ' │ │
- ' │ SUBDIR1$ and SUBDIR5$ returns a null$ or 0 len if there is no │
- ' │ directorys Otherwise return > 0 len or a string 'OK', you can │
- ' │ check for ether. │
- ' │ │
- ' │ NOTE: You must first Load QB or QBX with Quick Library │
- ' │ │
- ' │ For QuickBasic: QB /L QBSUBDIR.QLB │
- ' │ │
- ' │ For PDS7: QBX /L B7SUBDIR.QLB │
- ' │ │
- ' │ │
- ' │ │
- ' │ If you have or intend to use on DOS 5.0 then change the 1 to 5 in │
- ' │ SUBDIR1$. ( using 5 sorts directorys ) │
- ' └─────────────────────────────────────────────────────────────────────┘
-
-
-
- 'Start Of Program
- '-----------------------------------------------------------------------------
-
- '$DYNAMIC 'let make the program dynamic
- '$INCLUDE: 'subdir.bi' ' must include this in your programs
-
- ON ERROR GOTO ErrHandler ' error routine to make sure everythings OK
- CLS : SCREEN 0
-
- Fmat$ = "Directory Number:### ==> &"
- c$ = STRING$(80, 196)
-
- PRINT "Using the DO LOOP..."
- PRINT c$
-
- 'Call SUBDIR1$ with a root Path first
- ' you can call any SubDirectory, Example: C:\QB45
- junk$ = SUBDIR1$("c:\")
-
- ' If theres directorys, show them on the screen until all are read,
- ' Else there where no directorys were found.
- IF LEN(junk$) > 1 THEN
- 'Call SUBDIR1$ again but pass a null$
- DO: c = c + 1: PRINT USING Fmat$; c; SUBDIR1$(""): LOOP UNTIL EndDirectory
- ELSE
- 'Else None where found
- BEEP: PRINT "No Directorys Found..."
- END
- END IF
-
- 'Or ...
-
- SLEEP (1)
- PRINT : PRINT "Using the FOR NEXT LOOP..."
- PRINT c$;
-
- junk$ = SUBDIR1$("c:\") 'Call SUBDIR1$ with a path first
-
- ' Read it into x$ (or an array) and print Directorys found
- IF junk$ = "OK" THEN
- FOR j = 1 TO MaxCount
- 'Call SUBDIR1$ again but pass a null$
- x$ = SUBDIR1$("")
- PRINT USING "Directory Number:### ==> &"; j; x$
- NEXT j
- ELSE
- 'Else None where found
- BEEP: PRINT "No Directorys Found..."
- END
- END IF
-
- 'or
-
- SLEEP (1): CLS
-
- 'if your using PDS use the function CURDIR$
- DO: INPUT "Are you using (Q)uick Basic or Basic (P)DS7 "; Responce$
- LOOP UNTIL UCASE$(Responce$) = "Q" OR UCASE$(Responce$) = "P"
-
- IF UCASE$(Responce$) = "P" THEN BC7% = 1 ELSE BC7% = 0
-
- CLS : LOCATE 3, 12
- PRINT "(** Example use for changing directorys with SUBDIR1$ **)";
-
- LOCATE 5, 1
- PRINT " Use the UP or DOWN arrows to select the directory, Hit Enter key to shell...";
-
- LOCATE 6, 1: PRINT c$;
- LOCATE 8, 1: PRINT c$;
-
- LOCATE 1, 62: PRINT "Hit 'Esc' to Quit"
-
-
- 'Call SUBDIR1$ with a path first
- junk$ = SUBDIR1$("c:\")
-
- 'dim the x$ array after your first call with MaxCount
- IF junk$ = "OK" THEN
- DIM x$(1 TO MaxCount)
- ELSE
- BEEP: PRINT "No Directorys Found..."
- END
- END IF
-
- 'if OK, Read it into an array and show Directorys found
- FOR j = 1 TO MaxCount
- 'Call SUBDIR1$ again but pass a null$
- x$(j) = SUBDIR1$("")
- NEXT j
-
- 'show one of the directorys of the array
- LOCATE 7, 2
- PRINT x$(1);
-
- 'Put Array number at the begining
- ArrayNum% = 1
-
- DO
-
- DO: key$ = INKEY$: LOOP WHILE key$ = ""
-
- key$ = RIGHT$(key$, 1)
-
- SELECT CASE key$
- CASE CHR$(27)'escape
-
- ' Quit and exit do
- EXIT DO
-
- CASE CHR$(72)'up
-
- IF ArrayNum% > 1 THEN
- ArrayNum% = ArrayNum% - 1 'make the array go up
- ELSE
- SOUND 167, .5
- END IF
-
- CASE CHR$(80)'down
-
- IF ArrayNum% < MaxCount - 2 THEN
- ArrayNum% = ArrayNum% + 1 'make the array go down
- ELSE
- SOUND 167, .5
- END IF
-
- CASE CHR$(13)'enter
-
- IF BC7% THEN
- cd$ = CURDIR$
- ELSE
- END IF
-
- SHELL "CD " + x$(ArrayNum%) 'change dir
-
- PCOPY 0, 1: CLS : PRINT : PRINT
- PRINT "Type 'EXIT' to return to demo SUBDIR..."
- SHELL: PCOPY 1, 0
-
- IF BC7% THEN
- SHELL "CD " + cd$ 'change back to the original directory
- cd$ = ""
- ELSE
- END IF
-
-
- CASE ELSE
- END SELECT
-
- 'make sure the array is not bigger than the screen
- IF LEN(x$(ArrayNum%)) > 79 THEN
- LET x$(ArrayNum%) = LEFT$(x$(ArrayNum%), 76) + "..."
- END IF
-
- LOCATE 7, 2: PRINT SPACE$(79); ' clear the old
- LOCATE 7, 2: PRINT x$(ArrayNum%); ' show the new array
-
- LOOP
-
- PRINT
- LOCATE 11, 22: PRINT "If you liked this, Please Register!"
- LOCATE 13, 22: PRINT "Just Send $7.00 to:"
- LOCATE 15, 26: PRINT "ATTEN: SubDirectory program"
- LOCATE 16, 26: PRINT "Scott Roepenack"
- LOCATE 17, 26: PRINT "3760 Secor Road"
- LOCATE 18, 26: PRINT "South Venice, FL. 34293"
- LOCATE 20, 22: PRINT "With your name and address printed"
- BEEP
- END
-
- '---------------------------------------------------------------------------
-
- ErrHandler:
-
- SELECT CASE ERR
- CASE 57 'Device I/O error.
- END
- CASE 68 'Device unavailable.
- END
- CASE 71 'Drive not ready.
- END
- CASE ELSE
- STOP
- END SELECT
-
-