⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 util1-40.asi

📁 StarCom Manager 3.06 用QB编写的管理程序
💻 ASI
字号:
rem UTIL1-40.COM

rem consecutive to wait18:

rem initialize Esc key.  This is necessary because some parameters go directly 
rem to a routine; if it wasn't initialized here, it would have to be re-
rem initialized in every routine in which it was used.  CHR$(27) is the ASCII 
rem code for the Esc key.

b$=chr$(27)

rem initialize Enter (Return) key.  Same reason as the Esc key initialization, 
rem but applies mainly to the error routines.  CHR$(13) is the ASCII code for 
rem the Enter (Return) key.

c$=chr$(13)

rem Again, for the error routines, initialize the Backspace key and space bar.

d$=chr$(8)
e$=chr$(32)
lf$=chr$(10)
crlf$=c$+lf$
rem a=csrline (this is reserved in the subroutine CURSOR:)
rem b=pos(0) (also reserved in CURSOR: subroutine)
rem c=b-1 (reserved in CURSOR: subroutine)

a$=command$
if a$="/cr" then calculat:
if a$="/a" then asciilis:
if a$="/c" then changedi:
if a$="/i" then install:
if a$="/o" then movefile:


rem HERE IS THE ROUTINE FOR THE CRAPULATOR (CRAPPY CALCULATOR)

calculat:
width 40
print "Welcome to the Crapulator!"
print
print
print "You can add, subtract, or multiply two"
print "numbers.  You can use the numeric key-"
print "pad if you like; Num Lock has been"
print "turned on for you."
print
print
print "Press any key to continue. ";
gosub continue:
call "numlockn.exe",""
spaces$=space$(30)
print spaces$;
color 0,7
print "Esc=Quit"
color 7,0
print
print "Please enter your math problem. ";
gosub calcmore:

if operator$>"" then
print operator$;
calc1=val(calc$)
goto checkcal:
endif

checkcal:
if a$=c$ then
calc2=val(calc$)
goto docalc:
else
calc$=""
gosub calcmore:
goto checkcal:
endif

docalc:
if operator$="+" then
result=calc1+calc2
print "=";
print result
print
print "Press any key to return to the Main"
print "Options Menu. ";
gosub continue:
call "numlockf.exe",""
calc$=""
operator$=""
calc1=0
calc2=0
result=0
end
endif

if operator$="-" then
result=calc1-calc2
print "=";
print result
print
print "Press any key to return to the Main"
print "Options Menu. ";
gosub continue:
call "numlockf.exe",""
calc$=""
operator$=""
calc1=0
calc2=0
result=0
end
endif

if operator$="*" then
result=calc1*calc2
print "=";
print result
print
print "Press any key to return to the Main"
print "Options Menu. ";
gosub continue:
call "numlockf.exe",""
calc$=""
operator$=""
calc1=0
calc2=0
result=0
end
endif

calcmore:
gosub continue:

if a$=b$ then
operator$=""
calc$=""
calc1=0
calc2=0
result=0
call "numlockf.exe",""
end
endif

if a$="+" then
operator$="+"
return
endif

if a$="-" then
operator$="-"
return
endif

if a$="*" then
operator$="*"
return
endif

if a$=c$ then
return
endif

gosub cursor:

if a$=d$ then
locate a,c
print e$;
locate a,c
d=len(calc$)
e=d-1
calc$=mid$(calc$,1,e)
if e<0 then
e=0
c=c+1
locate a,c
endif
if b=0 then
a=a-1
b=38
locate a,b
print e$;
locate a,b
endif
goto calcmore:
endif

print a$;
calc$=calc$+a$
goto calcmore:

rem THIS IS THE END OF THE ROUTINE FOR THE CRAPULATOR (CRAPPY CALCULATOR).


rem HERE IS THE ROUTINE FOR GENERATING AN ASCII LIST.

asciilis:
width 40
print "Here are your options:"
print
print
print "F1- Print the entire list."
print
print "F2- Print one code of your choice."
print
print "Esc- Quit to Main Options Menu."
print
print
print "Please press the key corresponding to"
print "your choice. ";

wait:
gosub continue:

if a$=b$ then
end
endif

if extended=0 then wait:
if a$=";" then printlis:
if a$="<" then printone:
goto wait:

printlis:
cls
for c=0 to 255
print c;
print " - ";
a$=chr$(c)

if c=0 then
a$=" "
endif

print a$;
print " ";
column=column+1

if column=3 then
print
column=0
row=row+1
endif

if row=20 then
print
print
print "Press any key to continue. ";
gosub continue:
row=0
cls
endif

next c
print
print
print "Press any key to return to the Main"
print "Options Menu. ";
gosub continue:
end

printone:
width 40
print "Please type the code number of the"
print "character you want to view, from 0 to"
print "255. ";
gosub retypf40:
a=val(file$)
file$=""
if a<0 then printone:
if a>255 then printone:
onecode$=chr$(a)
locate 12,20
print onecode$
print
print
print "Press any key to return to the Main"
print "Options Menu. ";
gosub continue:
end

rem THIS IS THE END OF THE ROUTINE FOR GENERATING AN ASCII LIST.


rem HERE IS THE ROUTINE FOR CHANGING THE DEFAULT DIRECTORY.

changedi:
width 40
spaces$=space$(30)
print spaces$;
color 0,7
print "Esc=Quit"
color 7,0
print
print
print "This option will change the default"
print "directory where The Manager will look"
print "for files if you don't specify the"
print "path.  It's also the directory you'll"
print "be in when you return to DOS, unless"
print "you come back here and change to your"
print "previous directory before exiting."
print
print
print "Directory to change to? ";
gosub retypf40:

rechange:
chdir file$
if error=3 then nopathch:
file$=""
cls
print
print
print "Your new default directory is"
print nocase$;
print "."
print ""
print ""
print "Press any key to return to the Main"
print "Options Menu. ";
gosub continue:
end

rem THIS IS THE END OF THE ROUTINE FOR CHANGING THE DEFAULT DIRECTORY.


rem HERE IS THE ROUTINE FOR INSTALLING AN AUTOMATIC PARAMETER.

install:
width 40
print "This option will install an automatic"
print "parameter.  When you type MANAGER"
print "without any parameters, it will auto-"
print "matically go to the option you select."
print
print
print "Press any key to continue. ";
gosub continue:

installm:
cls
print "Here are some options you can install:"
print
print
print "F1- Help Screen."
print
print "F2- Delete Files."
print
print "F3- Make Directory."
print
print "F4- Rename Files."
print
print "F5- Get the Time/Date."
print
print "F6- Blank the Screen."
print
print "F7- Check for Graphics Card."
print
print "N- Next Menu."
print
print "Esc- Quit."
print
print
print "Please press the key corresponding to"
print "your choice. ";

wait2:
gosub continue:

if a$=b$ then
end
endif

if nocase$="N" then instalm2:
if extended=0 then wait2:
open "o",1,"install.cfg"

if a$=";" then
install$="/?"
gosub writeins:
goto writedon:
endif

if a$="<" then
install$="/d"
gosub writeins:
goto writedon:
endif

if a$="=" then
install$="/m"
gosub writeins:
goto writedon:
endif

if a$=">" then
install$="/n"
gosub writeins:
goto writedon:
endif

if a$="?" then
install$="/g"
gosub writeins:
goto writedon:
endif

if a$="@" then
install$="/b"
gosub writeins:
goto writedon:
endif

if a$="A" then
install$="/p"
gosub writeins:
goto writedon:
endif

goto wait2:

instalm2:
cls
print "Here are more options you can install:"
print
print
print "F8- Blank the Screen."
print
print "F9- Print File."
print
print "<Alt-F1>- Run Other Programs."
print
print "<Alt-F2>- Remove Directory."
print
print "<Alt-F3>- Copy Text File."
print
print "<Alt-F4>- Move Text File."
print
print "<Alt-F5>- Use 80-Column Mode."
print
print "<Alt-F6>- De-install Options."
print
print "Esc- Quit."
print
print
print "Please press the key corresponding to"
print "your choice. ";

wait3:
gosub continue:

if a$=b$ then
end
endif

if extended=0 then wait3:
open "o",1,"install.cfg"

if a$="B" then
install$="/s"
gosub writeins:
goto writedon:
endif

if a$="C" then
install$="/l"
gosub writeins:
goto writedon:
endif

if a$="D" then
install$="/r"
gosub writeins:
goto writedon:
endif

if a$="h" then
install$="/e"
gosub writeins:
goto writedon:
endif

if a$="i" then
install$="/c"
gosub writeins:
goto writedon:
endif

if a$="j" then
install$="/o"
gosub writeins:
goto writedon:
endif

if a$="k" then
install$="nothing"
gosub writeins:
goto writedon:
endif

if a$="l" then
install$="nothing"
gosub writeins:
goto writedon:
endif

goto wait3:

writeins:
print # 1, install$
close 1
return

writedon:
cls
print "The options you have chosen will now"
print "be run every time you load The Manager"
print "without parameters."
print
print
print "Press any key to return to the Main"
print "Options Menu. ";
gosub continue:
end

rem THIS IS THE END OF THE ROUTINE FOR INSTALLING A DOS PARAMETER.


rem HERE IS THE ROUTINE FOR MOVING A FILE.

movefile:
width 40
print "TEXT FILES ONLY!!!!!"
print
print
print "Press Esc to quit, or any other key to"
print "continue. ";
gosub continue:

if a$=b$ then
end
endif

movemore:
cls
spaces$=space$(30)
print spaces$;
color 0,7
print "Esc=quit"
color 7,0
print
print "File to move (include drive and path)?"
gosub retypf40:
realfil1$=ucase$(file$)
file$=""

print ""
print "Destination (include drive and path)?"
gosub retypf40:
realfil2$=ucase$(file$)
file$=""

reinputm:
open "i",1,realfil1$
if error=2 then nofilemf:

if error=3 then
io=1
goto nopathmf:
endif

reoutpum:
open "o",2,realfil2$

if error=3 then
io=1
goto nopathmf:
endif

if error=5 then noopenmf:

wait5:
input # 1, line$ crlf
if error=99 then movedone:

if error=96 then
print # 2, line$ nonull
input # 1, line$ crlf
if line$="" then
print # 2, crlf$ nonull
goto wait5:
endif
endif

print # 2, line$ nonull
print # 2, crlf$ nonull
goto wait5:

movedone:
close 1
close 2
kill realfil1$
print ""
print ""
print realfil1$;
print " has been moved to ";
print realfil2$;
print "."
print
print "Move another? ";

wait4:
gosub continue:
if nocase$="Y" then movemore:

if nocase$="N" then
end
endif

goto wait4:

rem THIS IS THE END OF THE ROUTINE FOR MOVING A FILE.


rem HERE IS THE ROUTINE FOR TYPING IN FILES IN 40-COLUMN MODE.

retypf40:
gosub continue:

if a$=b$ then
file$=""
return
endif

if a$=c$ then
return
endif

gosub cursor:

if a$=d$ then
locate a,c
print e$;
locate a,c
d=len(file$)
e=d-1
file$=mid$(file$,1,e)
if e<0 then
e=0
c=c+1
locate a,c
endif
if b=0 then
a=a-1
b=38
locate a,b
print e$;
locate a,b
endif
goto retypf40:
endif

print a$;
file$=file$+a$
nocase$=ucase$(file$)
goto retypf40:

rem THIS IS THE END OF THE ROUTINE FOR TYPING IN FILES IN 40-COLUMN MODE.


rem HERE IS THE ROUTINE FOR CONTINUING WHEN THE USER PRESSES A KEY.

continue:
a$=inkey$
if a$="" then continue:
nocase$=ucase$(a$)
return

rem THIS IS THE END OF THE ROUTINE FOR CONTINUING WHEN THE USER PRESSES A KEY.


rem HERE IS THE SUBROUTINE FOR INITIALIZING ROW/COLUMN POSITION OF CURSOR.

cursor:
a=csrlin
b=pos(0)
c=b-1
return

rem THIS IS THE END OF THE ROUTINE FOR INITIALIZING CURSOR POSITION.


rem .........................................................................

rem ERROR ROUTINES

rem .........................................................................


rem THIS IS THE ERROR ROUTINE FOR PATH NOT FOUND (CHANGEDI:)

nopathch:
cls
print "Path not found."
print
print
spaces$=space$(30)
print spaces$;
color 0,7
print "Esc=Quit"
color 7,0
print
print "Directory to change to? ";
gosub retypf40:
goto rechange:

rem THIS IS THE END OF THE ERROR ROUTINE FOR PATH NOT FOUND (CHANGEDI:)


rem HERE IS THE ERROR ROUTINE FOR FILE NOT FOUND (MOVEFILE:)

nofilemf:
cls
print "File not found."
print
spaces$=space$(30)
print spaces$;
color 0,7
print "Esc=Quit"
color 7,0
print
print "File to move? ";
gosub retypf40:
realfil1$=ucase$(file$)
file$=""
goto reinputm:

rem THIS IS THE END OF THE ERROR ROUTINE FOR FILE NOT FOUND (MOVEFILE:)


rem HERE IS THE ERROR ROUTINE FOR PATH NOT FOUND (MOVEFILE:)

nopathmf:
cls
print "Path not found."
print
spaces$=space$(30)
print spaces$;
color 0,7
print "Esc=Quit"
color 7,0
print

if io=1 then
print "File to move? ";
gosub retypf40:
realfil1$=ucase$(file$)
file$=""
goto reinputm:
endif

if io=2 then
print "Destination for ";
print realfil1$;
print "?"
print "> ";
gosub retypf40:
realfil2$=ucase$(file$)
file$=""
goto reoutpum:
endif

rem THIS IS THE END OF THE ERROR ROUTINE FOR PATH NOT FOUND (MOVEFILE:)


rem HERE IS THE ERROR ROUTINE FOR ACCESS DENIED (MOVEFILE:)

noopenmf:
cls
print "Protected destination, can't overwrite"
print
spaces$=space$(30)
print spaces$;
color 0,7
print "Esc=Quit"
color 7,0
print
print "Destination for ";
print realfil1$;
print "?"
print "> ";
gosub retypf40:
realfil2$=ucase$(file$)
file$=""
goto reoutpum:

rem THIS IS THE END OF THE ERROR ROUTINE FOR ACCESS DENIED (MOVEFILE:)

rem THIS IS THE END OF THE ERROR ROUTINES FOR MOVEFILE:


rem .........................................................................

rem THIS IS THE END OF THE ERROR ROUTINES.

rem .........................................................................


end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -