home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
UTILS2
/
PWRBAT20.ZIP
/
PB20DEMO.PWR
< prev
next >
Wrap
Text File
|
1994-01-02
|
17KB
|
443 lines
Variable Fore,1 ;save areas for initial colors
Variable Back,1
Variable ColorAttr,3
Variable Prn,3
Variable CharIn,1 ;for user responses
Variable FnKey,1
Variable RedOnGray,3,116
Variable RedOnBlack,3,4
Variable YelOnBlue,3,30
Variable YelOnGray,3,126
Variable BlueOnGray,3,113
Variable F1,1,#59 ;key value for F1
Variable ID,4
Variable MainTitle,36,'126PowerBatch 116Functions'
Variable M1L1,34,'116Get 126S116ystem Information'
Variable M1L2,22,'116Draw 126B116oxes'
Variable M1L3,35,'116Get Input From 126K116eyboard'
Variable M1L4,28,'116St126R116ing Functions'
Variable M1L5,25,'116Screen 126W116rites'
Variable M1L6,21,'126M116iscellaneous'
Variable M2L1,25,'116Current 126C116olor'
Variable M2L2,29,'116Current 126D116irectory'
Variable M2L3,24,'116Current Da126T116e'
Variable M2L4,21,'116Disk126S116pace'
Variable M2L5,29,'126E116nvironment Variables'
Variable M2L6,24,'116Current Ti126M116e'
Variable Msg,78
Variable EscMsg,13,' Esc To Quit '
Variable ContMsg,25,'Press Any Key To Continue'
Variable ColorMsg1,78,'PowerBatch will supply you with the current foreground, background, and'
Variable ColorMsg2,78,'composite color by issuing the command ?COLOR. This message is displayed'
Variable ColorMsg3,78,'using the color attributes active when DEMO2 was started.'
Variable DOW,9 ;for date command
Variable Mo,2
Variable Da,2
Variable Yr,4
Variable CurrTime,11 ;for current time
Variable DriveLtr,1
Variable DirName,78 ;for user entered directory name
Variable FileName,78 ;for user entered file name
Variable Space35,35," "
Variable Space76,76," "
Variable TotSpace,10
Variable AvailSpace,10
Variable Msg2,78
Variable FName,35
Variable LName,35
?Color Fore,Back,ColorAttr ;initial color
?Date DOW,Mo,Da,Yr ;get system date
?Time CurrTime ;get system time
Cursor 2
Clear
SetVar CharIn,DispAdapter
Compare CharIn,"C",,,ColorMon
WriteLine 'This demo is designed to run on a color monitor'
Halt
Label ColorMon
Clear YelOnGray ;clear to my color
Box4 25,2,51,16,116
WriteAt 28,2,MainTitle
WriteAt 27,4,M1L1
WriteAt 27,6,M1L2
WriteAt 27,8,M1L3
WriteAt 27,10,M1L4
WriteAt 27,12,M1L5
WriteAt 27,14,M1L6
WriteAt 33,16,EscMsg
Label GetM1
GoToXY 39,15
Write ' '
GoToXY 39,15
ReadUpKey CharIn
Compare CharIn,'',,,Finis
Compare CharIn,'S',,,SysInfo
Compare CharIn,'B',,,BoxInfo
Compare CharIn,'K',,,KeyBdInfo
Compare CharIn,'R',,,StrInfo
Compare CharIn,'W',,,WritInfo
Compare CharIn,'M',,,MiscInfo
Beep 800,1
Beep 300,2
GoTo GetM1
Label SysInfo
Box4 40,4,64,18,116
Color RedOnGray
WriteAt 43,4,'System Information'
WriteAt 42,6,M2L1
WriteAt 42,8,M2L2
WriteAt 42,10,M2L3
WriteAt 42,12,M2L4
WriteAt 42,14,M2L5
WriteAt 42,16,M2L6
WriteAt 48,18,EscMsg
Label GetM2
GoToXY 52,17
Write ' '
GoToXy 52,17
ReadUpKey CharIn
Compare CharIn,'',,,ColorMon
Compare CharIn,'C',,,ColorInfo
Compare CharIn,'D',,,DirInfo
Compare CharIn,'T',,,DateInfo
Compare CharIn,'S',,,SpaceInfo
Compare CharIn,'E',,,EnvirInfo
Compare CharIn,'M',,,TimeInfo
Beep 800,1
Beep 300,2
GoTo GetM2
Label ColorInfo
WriteAt 2,20,ColorMsg1,ColorAttr
WriteAt 2,21,ColorMsg2,ColorAttr
WriteAt 2,22,ColorMsg3,ColorAttr
GoTo M2Cont
Label DirInfo
SetVar DriveLtr,'A'
?CurrDir DriveLtr,DirName
Concat Msg,'Drive A current directory is ',DirName
WriteAt 2,20,Msg
Label DrC
SetVar DriveLtr,'C'
?DriveExist DriveLtr,DrCOK
WriteAt 2,21,'No drive C defined in your system.'
GoTo M2Cont
Label DrCOK
?CurrDir DriveLtr,DirName
Concat Msg,'Drive C current directory is ',DirName
WriteAt 2,21,Msg
SetVar DriveLtr,'D'
?DriveExist DriveLtr,DrDOK
WriteAt 2,22,'No drive D defined in your system.'
GoTo M2Cont
Label DrDOK
?CurrDir DriveLtr,DirName
Concat Msg,'Drive D current directory is ',DirName
WriteAt 2,22,Msg
GoTo M2Cont
Label DateInfo
Concat Msg,'Today is ',DOW
Concat Msg,' '
Concat Msg,Mo
Concat Msg,'/'
Concat Msg,Da
Concat Msg,'/'
Concat Msg,Yr
WriteAt 2,20,Msg
GoTo M2Cont
Label SpaceInfo
WriteAt 2,20,'Enter drive letter '
ReadUpKey DriveLtr
?DriveExist DriveLtr,ValidDr
WriteAt 2,20,'Invalid Drive !!! '
GoTo GetM2
Label ValidDr
?DiskSpace DriveLtr,TotSpace,AvailSpace
Compare TotSpace,0,,DrNotRdy,DrNotRdy
Concat Msg,'Drive ',DriveLtr
Concat Msg,' has a capacity of '
Concat Msg,TotSpace
Concat Msg,' bytes. The disk has '
Concat Msg,AvailSpace
Concat Msg,' bytes free.'
WriteAt 2,20,Msg
GoTo M2Cont
Label DrNotRdy
WriteAt 2,20,'Drive not ready !!!'
GoTo M2Cont
Label EnvirInfo
?EnvStr 'PATH',DirName
Concat Msg,'Current path is ',DirName
WriteAt 2,20,Msg
?EnvStr 'PROMPT',DirName
Concat Msg,'Your prompt command is ',DirName
WriteAt 2,21,Msg
?EnvStr 'COMSPEC',DirName
Concat Msg,'Your command processor is ',DirName
WriteAt 2,22,Msg
GoTo M2Cont
Label TimeInfo
WriteAt 27,23,ContMsg,RedOnGray
Label UpdtTime
?Time CurrTime
Concat Msg,'Your system time is currently ',CurrTime
WriteAt 2,20,Msg
ReadKey CharIn,,1
Compare CharIn,'',,,UpdtTime
ClearBox 1,19,78,24,YelOnGray
GoTo GetM2
Label M2Cont
WriteAt 27,23,ContMsg,RedOnGray
ReadKey CharIn
ClearLine 20,RedOnGray
ClearLine 21,RedOnGray
ClearLine 22,RedOnGray
GoTo GetM2
Label BoxInfo
Clear
Box1 10,2,55,15,116
WriteAt 12,4,'PowerBatch draws four types of boxes...'
WriteAt 14,6,'A single line border'
Wait 50
Box2 10,2,55,15,116
WriteAt 12,4,'PowerBatch draws four types of boxes...'
WriteAt 14,6,'A double line border'
Wait 30
Box3 10,2,55,15,116
WriteAt 12,4,'PowerBatch draws four types of boxes...'
WriteAt 14,6,'A solid line border'
Wait 30
Box4 10,2,55,15,116,,15
WriteAt 12,4,'PowerBatch draws four types of boxes...'
WriteAt 14,6,'A single line border with a shadow'
Wait 30
WriteAt 14,8,'You can clear the contents of a box'
WriteAt 14,9,'without redrawing the box or clearing'
WriteAt 14,10,'the screen...'
Wait 50
ClearBox 10,2,55,15,116
WriteAt 12,4,'Boxes can be drawn so quickly they can'
WriteAt 12,5,'be made to appear to move.'
Wait 50
ClearBox 9,1,58,16,116
Box1 11,3,56,16,116
ClearBox 10,2,57,17,116
Box1 12,4,57,17,116
ClearBox 11,3,58,18,116
Box1 13,5,58,18,116
ClearBox 12,4,59,19,116
Box1 14,6,59,19,116
ClearBox 13,5,60,20,116
Box1 15,7,60,20,116
ClearBox 14,6,61,21,116
Box1 16,8,61,21,116
ClearBox 15,7,62,22,116
Box4 17,9,62,22,116,,15
WriteAt 19,11,'Boxes can be drawn so quickly they can'
WriteAt 19,12,'be made to appear to move.'
Wait 50
GoTo ColorMon
Label KeyBdInfo
Clear
Box1 5,5,75,19,116
WriteAt 7,7,'There are several keyboard read functions in PowerBatch.'
WriteAt 7,8,'You can read a single character (and only one character) from the'
WriteAt 7,9,'keyboard, including all special characters like Alt-F1; you can'
WriteAt 7,10,'read a string of a specified length and not accept any additional'
WriteAt 7,11,'characters; you can read a single key and change the character'
WriteAt 7,12,'to upper case regardless of the case entered; and you can read'
WriteAt 7,13,'a key in response to a (Y)es or (N)o question, forcing the key'
WriteAt 7,14,'to upper case Y or N, and accepting no other characters.'
WriteAt 7,16,'For Example...'
Label ForceF1
WriteAt 14,17,'Press F1 for Help '
ReadKey CharIn,FnKey
Compare FnKey,1,,,SpecKey
Beep 500,3
GoTo ForceF1
Label SpecKey
Compare CharIn,F1,,,GotF1
Beep 500,3
GoTo ForceF1
Label GotF1
WriteAt 14,17,'Help is on the way...'
Wait 30
WriteAt 14,17,'Enter Your 4 Digit ID Number And Press Enter '
ReadStr ID
Wait 20
MidString Msg,Space76,1,50
WriteAt 14,17,Msg
WriteAt 14,17,'Enter The Drive Letter To Check '
ReadUpKey CharIn
Wait 20
GoToXY 14,17
ReadYN 'Do you wish to continue with this demo (Y/N) ',CharIn
Wait 30
GoTo ColorMon
Label StrInfo
Clear
Box2 1,1,80,11,116 ;for variables
Box1 1,12,39,24,116 ;for compare
Box1 41,12,80,24,116 ;for midstring
Center ' Variable ',1
WriteAt 15,12,' Compare '
WriteAt 54,12,' MidString '
WriteAt 2,2,'The VARIABLE command is one of the commands which makes PowerBatch unique'
WriteAt 2,3,'among its competitors. You can define variables and constants, give them'
WriteAt 2,4,'an english name, change them, write them, use them as commands, add and'
WriteAt 2,5,'subtract to them, and even use them as parms in a DOS command! There is no'
WriteAt 2,6,'limit to them and they are static, not gradually eating away at your memory.'
WriteAt 2,7,'They are resolved to address locations at compile time and are smart enough'
WriteAt 2,8,'to know if they should be treated as alpha or numeric. You can imbed color'
WriteAt 2,9,'commands in the text definition and give them values you cannot even find a'
WriteAt 2,10,'key for on your keyboard. You can do almost anything to them but abuse them.'
; 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
;...5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
WriteAt 2,14,'The Compare command allows you to'
WriteAt 2,15,'compare two variables, or a variable'
WriteAt 2,16,'and a constant and execute various'
WriteAt 2,17,'parts of your batch program based on'
WriteAt 2,18,'the results. Compare will properly'
WriteAt 2,19,'evaluate 2 compared to 19 (DOS will'
WriteAt 2,20,'not) shifting between numeric and'
WriteAt 2,21,'alphabetic comparisions based on the'
WriteAt 2,22,'contents of the variables being'
WriteAt 2,23,'compared.'
WriteAt 43,14,'The MidString command allows you to'
WriteAt 43,15,'separate variables into smaller'
WriteAt 43,16,'parts as needed. If you enter a'
WriteAt 43,17,'date from the keyboard as mm/dd/yy'
WriteAt 43,18,'you can break it apart into the 3'
WriteAt 43,19,'components with the MidString'
WriteAt 43,20,'command.'
Center 'Press Any Key To Continue',25
ReadKey CharIn
Clear
Box1 1,1,39,11,116
WriteAt 16,1,' Concat '
Box1 41,1,80,11,116
WriteAt 56,1,' Length '
Box1 1,13,39,24,116
WriteAt 16,13,' Lower '
Box1 41,13,80,24,116
WriteAt 56,13,' Upper '
; 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
;...5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
WriteAt 2,3,'The Concat command is used to combine'
WriteAt 2,4,'two variables (or combinations of'
WriteAt 2,5,'variables and constants) into one'
WriteAt 2,6,'variable.'
WriteAt 2,7,' Concat Msg,DrIn,ErrMsg6'
WriteAt 2,8,'would combine the contents of DrIn'
WriteAt 2,9,'and ErrMsg6 into the variable Msg.'
WriteAt 42,3,'The Length command will calculate'
WriteAt 42,4,'the length of any variable. This'
WriteAt 42,5,'length is valuable when using the'
WriteAt 43,6,'MidString command.'
; 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
;...5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
WriteAt 2,14,'The Lower command will change any'
WriteAt 2,15,'upper case characters to lower'
WriteAt 2,16,'case. Any characters which are not'
WriteAt 2,17,'alphabetic characters will remain'
WriteAt 2,18,'unchanged.'
WriteAt 42,14,'The Upper command will change any'
WriteAt 42,15,'lower case characters to upper'
WriteAt 42,16,'case. Any characters which are not'
WriteAt 42,17,'alphabetic characters will remain'
WriteAt 42,18,'unchanged.'
Center 'Press Any Key To Continue',25
ReadKey CharIn
GoTo ColorMon
Label WritInfo
Box2 5,5,76,20,116
WriteAt 7,7,'PowerBatch contains a number of screen writing commands, all designed'
WriteAt 7,8,'to get the information to the screen as quickly as possible. One of'
WriteAt 7,9,'the major deficiencies of the DOS batch file is the slow screen write'
WriteAt 7,10,'functions associated with DOS. To get a feel for the speed at which'
WriteAt 7,11,'PowerBatch writes to the screen, press any key to redisplay this'
WriteAt 7,12,'entire screen. I will clear the screen, draw the box, center the'
WriteAt 7,13,'title, and rewrite all the text. Ready when you are...'
ReadKey CharIn
Clear
Box2 5,5,76,20,116
Center ' PowerBatch Screen Write Functions ',5
WriteAt 7,7,'PowerBatch contains a number of screen writing commands, all designed'
WriteAt 7,8,'to get the information to the screen as quickly as possible. One of'
WriteAt 7,9,'the major deficiencies of the DOS batch file is the slow screen write'
WriteAt 7,10,'functions associated with DOS. To get a feel for the speed at which'
WriteAt 7,11,'PowerBatch writes to the screen, press any key to redisplay this'
WriteAt 7,12,'entire screen. I will clear the screen, draw the box, center the'
WriteAt 7,13,'title, and rewrite all the text. Were you impressed...'
Wait 50
ClearBox 5,5,76,20,116
WriteAt 7,7,'PowerBatch provides 4 screen writing commands: 1) WriteAT, 2) Write,'
WriteAt 7,8,'3) WriteLine, and 4) Center. Lets look at the differences in these'
WriteAt 7,9,'commands. Center is the most obvious. If you want to center a line'
WriteAt 7,10,'of text, use this command. It was used to center the title on this'
WriteAt 7,11,'box and the message at the bottom.'
Center ' Press Any Key To Continue ',20
ReadKey CharIn
ClearBox 5,5,76,20,116
WriteAt 7,7,'WriteAt has the syntax'
WriteAt 12,8,'WriteAT Col,Row,Text To Be Written'
WriteAt 7,9,'It allows you to position text anywhere on the screen with direct'
WriteAt 7,10,'screen co-ordinates.'
WriteAt 7,12,'Write has the syntax'
WriteAt 12,13,'Write Text To Be Written'
WriteAt 7,14,'Text is written beginning with the current cursor location. It can'
WriteAt 7,15,'be thought of as on screen concatenation.'
WriteAt 7,17,'WriteLine has the syntax'
WriteAt 12,18,'WriteLine Row,Text To Be Written'
WriteAt 7,19,'The text is written on the specified Row beginning in column 1.'
ReadKey CharIn
GoTo ColorMon
Label MiscInfo
Box2 1,1,80,25,116
Center ' Miscellaneous Functions ',1
Center EscMsg,25
; 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
;..5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
WriteAt 3,3,'ADD Provides the ability to increment a counter. Useful for looping'
WriteAT 3,4,' through a routine X times as well as arithmatic.'
WriteAT 3,5,'BEEP Complete control over the system speaker. Sound the speaker at a'
WriteAT 3,6,' specified frequency for any length of time and repeat N times.'
WriteAT 3,7,'BLINK Will cause all following write statements to be written with the'
WriteAT 3,8,' current color attribute but with the'
Blink
WriteAT 51,8,'blink'
Normal
WriteAT 57,8,'bit on. NORMAL resets.'
; 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
;..5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
WriteAT 3,9,'CENTER Used to center text on the screen. The title of this screen was'
WriteAT 3,10,' centered after the box was drawn.'
WriteAt 3,11,'CONCAT Provides a means to combine two text strings into one. Use this'
WriteAT 3,12,' command to build messages prior to writing to the screen.'
WriteAt 20,13,'Variable Err1,25, is an invalid drive!'
WriteAt 20,14,'Concat Msg1, DriveInput, Err1'
WriteAt 20,15,'WriteAt 2,25,Msg1'
WriteAt 3,16,'LENGTH Calculates the length of a string. Use in conjunction with the'
WriteAt 3,17,' MIDSTRING command or for editing of input data.'
WriteAt 3,18,'LOWER Changes all alphabetic characters in a string to lower case without'
WriteAt 3,19,' having any effect on non-alphabetic characters in the string.'
WriteAt 3,20,'REVERSE Will cause all write statements that follow to be written in'
Reverse
WriteAt 14,21,'reverse'
Normal
WriteAt 22,21,'video. Use NORMAL to reset the color to the prior value.'
WriteAt 3,22,'SUBTRACT Provides the ability to decrement a counter.'
WriteAt 3,23,'UPPER Changes all alphabetic characters in a string to upper case without'
WriteAt 3,24,' having any effect on non-alphabetic characters in the string.'
ReadKey CharIn
GoTo ColorMon
Label Finis
Clear
Color ColorAttr ;reset original colors
Clear
Box3 24,1,56,5,ColorAttr
Center "POWERBATCH",2
Center "By",3
Center "Computing Systems Design, Inc.",4
GoToXy 1,24
Cursor 1