home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 26
/
CD_ASCQ_26_1295.iso
/
vrac
/
volume_3.zip
/
WORK1.BAS
< prev
Wrap
BASIC Source File
|
1995-09-10
|
9KB
|
254 lines
DECLARE FUNCTION INC! (i%)
DECLARE SUB LocateYX (y%, X%)
DECLARE FUNCTION YesNo$ (Msg$, y%, X%)
DECLARE FUNCTION CharFromTo$ (a$, First%, Last%)
DECLARE FUNCTION CharAt$ (a$, i%)
DECLARE SUB Center.Message (Msg$, Line.Num%)
CONST MAX.SCRN.COL% = 80
CONST MAX.SCRN.ROW% = 25
CONST TRUE% = 1
CONST FALSE% = 0
File.Data$ = ""
VOID$ = ""
Selected.Label% = 0
StopIt% = FALSE%
DIM Label(1 TO 100) AS STRING
CLS
Counter% = 1
'
'*********************************************************************
'Reads in all Labels in Autoexec.Bat File, Stores each name in a array
'and then diplays the Label Names to you. You then can pick the one
'you want to write to a separate file called exec.001
'**********************************************************************
OPEN "C:\AUTOEXEC.BAT" FOR INPUT AS #1
DO WHILE NOT EOF(1)
LINE INPUT #1, Label(Counter%)
IF CharAt$(Label(Counter%), 1) = ":" THEN
IF Label(Counter%) <> ":END" THEN
PRINT "Label "; Counter%, Label(Counter%)
Counter% = INC!(Counter%)
END IF
END IF
LOOP
CLOSE #1
'
'
'**************************************************************************
'Allows you pick a number for all the labels shown
'**************************************************************************
INPUT "Pick a number from above which one you want to run Memmaker on ? ", Selected.Label%
'***************************************************************************
'********* Checks number for label you selected.....cheap error checking!
'***************************************************************************
IF Selected.Label% >= Counter% OR Selected.Label% <= 0 THEN
PRINT "Number out of range"
CLOSE #2
CLOSE #1
END
END IF
Store$ = Label(Selected.Label%)
'
'**************************************************************************
'This actually writes the File EXEC.001 with the label you picked
'from above
'**************************************************************************
StopIt% = FALSE%
CLS
LOCATE 10, 30
PRINT "Writing EXEC.001 File for LABEL>> " + Store$
LOCATE 11, 30
PRINT "PLEASE WAIT!"
OPEN "C:\AUTOEXEC.BAT" FOR INPUT AS #1
DO WHILE NOT EOF(1) AND StopIt% = FALSE%
LINE INPUT #1, File.Data$
IF File.Data$ = Label(Selected.Label%) THEN
OPEN "C:\exec.001" FOR OUTPUT AS #2
PRINT #2, Label(Selected.Label%)
DO
LINE INPUT #1, File.Data$
IF CharAt$(File.Data$, 1) <> ":" THEN
IF UCASE$(CharFromTo(File.Data$, 1, 4)) <> "GOTO" THEN
PRINT #2, File.Data$
ELSE
PRINT #2, "REM " + File.Data$
END IF
ELSE
StopIt% = TRUE%
File.Data$ = ""
END IF
LOOP WHILE NOT EOF(1) AND StopIt% = FALSE%
END IF
LOOP
CLOSE #2
CLOSE #1
Counter% = 1
LOCATE 12, 30
INPUT "Press Enter to continue", VOID$
CLS
OPEN "C:\CONFIG.SYS" FOR INPUT AS #1
DO WHILE NOT EOF(1)
LINE INPUT #1, Label(Counter%)
IF CharAt$(Label(Counter%), 1) = "[" THEN
PRINT "Label "; Counter%, Label(Counter%)
Counter% = INC!(Counter%)
END IF
LOOP
CLOSE #1
PRINT "****** BE SURE TO PICK THE SAME ONE AS YOU DID IN AUTOEXEC.BAT"
PRINT "You picked " + Store$ + " in your AUTOEXEC.BAT file"
INPUT "Pick a number from above which one you want to run Memmaker on ? ", Selected.Label%
'********* Checks number error checking!
IF Selected.Label% >= Counter% OR Selected.Label% <= 0 THEN
PRINT "Number out of range"
CLOSE #1
CLOSE #2
END
END IF
CLS
LOCATE 10, 30
PRINT "Writing SYS.001 File for LABEL>> " + Store$
LOCATE 11, 30
PRINT "Please Wait!"
StopIt% = FALSE%
OPEN "C:\CONFIG.SYS" FOR INPUT AS #1
DO WHILE NOT EOF(1) AND StopIt% = FALSE%
LINE INPUT #1, File.Data$
IF File.Data$ = Label(Selected.Label%) THEN
OPEN "C:\SYS.001" FOR OUTPUT AS #2
PRINT #2, "REM " + Label(Selected.Label%)
DO
LINE INPUT #1, File.Data$
IF CharAt$(File.Data$, 1) = "[" THEN
StopIt% = TRUE%
File.Data$ = ""
ELSE
PRINT #2, File.Data$
END IF
LOOP WHILE NOT EOF(1) AND StopIt% = FALSE%
END IF
LOOP
CLOSE #2
LOCATE 12, 30
INPUT "Press Enter to continue", VOID$
CLS
CLOSE #1
LOCATE 10, 1
PRINT "**************************************************"
PRINT "NOTE:"
PRINT "FIRST WE BACK UP OF THE CURRENT AUTOEXEC.BAT & CONFIG.SYS"
PRINT "TO AUTOEXEC.BAK & CONFIG.BAK"
PRINT "SECOND WE BACK UP THE LABEL FILE YOU SELECTED"
PRINT "THIRD WE DEL AUTOEXEC.BAT & CONFIG.SYS &"
PRINT "THEN WE REPACE IT WITH THE LABEL YOU SELECTED"
PRINT "****************************************************"
PRINT "Do you wish to MAKE THE LABEL FILE YOU SELECTED THE CURRENT"
PRINT "AUTOEXEC.BAT & CONFIG.SYS File? "
PRINT "So that memmaker can process it?"
INPUT "Y to process it or N to Quit ? > ", VOID$
IF UCASE$(VOID$) <> "Y" THEN
END
ELSE
CLS
PRINT "I will now backup your Autoexec.bat & config.sys file"
INPUT "Press enter to continue", VOID$
OPEN "c:\gg212.bat" FOR OUTPUT AS #1
PRINT #1, "copy c:\autoexec.bat c:\autoexec.bak"
PRINT #1, "copy C:\exec.001 c:\exec.bak"
PRINT #1, "del c:\autoexec.bat "
PRINT #1, "ren c:\exec.001 autoexec.bat"
PRINT #1, "copy c:\config.sys c:\config.bak"
PRINT #1, "copy c:\sys.001 c:\sys.bak"
PRINT #1, "del c:\config.sys"
PRINT #1, "copy c:\sys.001 c:\config.sys"
CLOSE #1
SHELL "c:\gg212.bat"
SHELL "DEL C:\GG212.BAT"
PRINT "Press Enter to continue ";
INPUT VOID$
END IF
END
SUB Center.Message (Msg$, Line.Num%)
IF Line.Num% <= MAX.SCRN.ROW% THEN
IF Line.Num% > 0 THEN
LOCATE Line.Num%, 1
PRINT STRING$(MAX.SCRN.COL%, " ");
LOCATE Line.Num%, INT((MAX.SCRN.COL% - LEN(Msg$)) / 2)
PRINT Msg$;
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END SUB
FUNCTION CharAt$ (a$, i%)
IF i% > 0 THEN
CharAt$ = MID$(a$, i%, 1)
ELSE
SOUND 2000, 60
END IF
END FUNCTION
FUNCTION CharFromTo$ (a$, First%, Last%)
IF First% <= Last% THEN
CharFromTo$ = MID$(a$, First%, (Last% - First% + 1))
END IF
END FUNCTION
SUB DEC (i%)
i% = i% - 1
END SUB
FUNCTION INC (i%)
i% = i% + 1
INC = i%
END FUNCTION
SUB LocateYX (y%, X%)
IF y% > 0 THEN
IF y% < 26 THEN
IF X% > 0 THEN
IF X% < 80 THEN
LOCATE y%, X%
END IF
END IF
END IF
END IF
END SUB
FUNCTION YesNo$ (Msg$, y%, X%)
'This will return "Y" or "N"
Answer$ = " "
WHILE (INSTR("YyNn", Answer$) = 0)
CALL LocateYX(y%, X%)
PRINT Msg$;
CurrentX% = POS(0)
CurrentY% = CSRLIN
INPUT " (Y/N) "; Answer$
S = LEN(Answer$)
CALL LocateYX(CurrentY%, CurrentX%)
PRINT STRING$(S + 9, " ")
IF S > 0 THEN Answer$ = LEFT$(Answer$, 1)
WEND
YesNo$ = UCASE$(Answer$)
END FUNCTION