home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / asic / manage / util1-40.asi < prev    next >
Encoding:
Text File  |  1993-05-01  |  13.3 KB  |  786 lines

  1. rem consecutive to wait2:
  2.  
  3. rem initialize Esc key.  This is necessary because some parameters go directly 
  4. rem to a routine; if it wasn't initialized here, it would have to be re-
  5. rem initialized in every routine in which it was used.  CHR$(27) is the ASCII 
  6. rem code for the Esc key.
  7.  
  8. b$=chr$(27)
  9.  
  10. rem initialize Enter (Return) key.  Same reason as the Esc key initialization, 
  11. rem but applies mainly to the error routines.  CHR$(13) is the ASCII code for 
  12. rem the Enter (Return) key.
  13.  
  14. c$=chr$(13)
  15.  
  16. rem Again, for the error routines, initialize the Backspace key and space bar.
  17.  
  18. d$=chr$(8)
  19. e$=chr$(32)
  20. lf$=chr$(10)
  21. crlf$=c$+lf$
  22. rem a=csrline (this is reserved in the subroutine CURSOR:)
  23. rem b=pos(0) (also reserved in CURSOR: subroutine)
  24. rem c=b-1 (reserved in CURSOR: subroutine)
  25.  
  26. a$=command$
  27. if a$="/d" then killfl40:
  28. if a$="/cr" then calculat:
  29. if a$="/a" then asciilis:
  30. if a$="/c" then changedi:
  31. if a$="/i" then install:
  32.  
  33. rem Here is the routine for deleting files in 40-column mode.
  34.  
  35. killfl40:
  36. width 40
  37. print "Delete Files"
  38. print
  39. print
  40. print "Before going any further, you should"
  41. print "be aware that, once a file has been"
  42. print "deleted, it is very difficult to"
  43. print "retrieve it.  From this program, it is"
  44. print "impossible; I lack the skill to make"
  45. print "an undelete feature available."
  46. print
  47. print
  48. print "Press any key to continue, or Esc to"
  49. print "quit. ";
  50.  
  51. gosub continue:
  52.  
  53. if a$=b$ then
  54. end
  55. endif
  56.  
  57. delagn40:
  58. width 40
  59. print "Delete Files"
  60. print
  61. print
  62. spaces$=space$(30)
  63. print spaces$;
  64. color 0,7
  65. print "Esc=Quit"
  66. color 7,0
  67. print "File to delete? ";
  68. gosub retypf40:
  69. realfile$=ucase$(file$)
  70.  
  71. print ""
  72. print ""
  73. print ""
  74. print "All the data in ";
  75. print realfile$;
  76. print " will be de-"
  77. print "stroyed."
  78. print
  79. print
  80. print "Press any key to continue, or Esc to"
  81. print "quit. ";
  82.  
  83. gosub continue:
  84.  
  85. if a$=b$ then
  86. end
  87. endif
  88.  
  89. rekill40:
  90. kill file$
  91. if error=2 then noflkf40:
  92. if error=5 then ilglkf40:
  93. print ""
  94. print ""
  95. print realfile$;
  96. print " has been deleted."
  97. file$=""
  98. print
  99. print "Delete another? (y/n) ";
  100.  
  101. wait15:
  102. gosub continue:
  103. if a$="y" then delagn40:
  104. if a$="Y" then delagn40:
  105.  
  106. if a$="n" then
  107. end
  108. endif
  109.  
  110. if a$="N" then
  111. end
  112. endif
  113.  
  114. goto wait15:
  115.  
  116. rem This is the end of the routine for deleting files in 40-column mode.
  117.  
  118.  
  119. rem HERE IS THE ROUTINE FOR THE CRAPULATOR (CRAPPY CALCULATOR)
  120.  
  121. calculat:
  122. width 40
  123. print "Welcome to the Crapulator!"
  124. print
  125. print
  126. print "You can add, subtract, or multiply two"
  127. print "numbers.  You can use the numeric key-"
  128. print "pad if you like; Num Lock has been"
  129. print "turned on for you."
  130. print
  131. print
  132. print "Press any key to continue. ";
  133. gosub continue:
  134. call "numlockn.exe",""
  135. spaces$=space$(30)
  136. print spaces$;
  137. color 0,7
  138. print "Esc=Quit"
  139. color 7,0
  140. print
  141. print "Please enter your math problem. ";
  142. gosub calcmore:
  143.  
  144. if operator$>"" then
  145. print operator$;
  146. calc1=val(calc$)
  147. goto checkcal:
  148. endif
  149.  
  150. checkcal:
  151. if a$=c$ then
  152. calc2=val(calc$)
  153. goto docalc:
  154. else
  155. calc$=""
  156. gosub calcmore:
  157. goto checkcal:
  158. endif
  159.  
  160. docalc:
  161. if operator$="+" then
  162. result=calc1+calc2
  163. print "=";
  164. print result
  165. print
  166. print "Press any key to return to the Main"
  167. print "Options Menu. ";
  168. gosub continue:
  169. call "numlockf.exe",""
  170. calc$=""
  171. operator$=""
  172. calc1=0
  173. calc2=0
  174. result=0
  175. end
  176. endif
  177.  
  178. if operator$="-" then
  179. result=calc1-calc2
  180. print "=";
  181. print result
  182. print
  183. print "Press any key to return to the Main"
  184. print "Options Menu. ";
  185. gosub continue:
  186. call "numlockf.exe",""
  187. calc$=""
  188. operator$=""
  189. calc1=0
  190. calc2=0
  191. result=0
  192. end
  193. endif
  194.  
  195. if operator$="*" then
  196. result=calc1*calc2
  197. print "=";
  198. print result
  199. print
  200. print "Press any key to return to the Main"
  201. print "Options Menu. ";
  202. gosub continue:
  203. call "numlockf.exe",""
  204. calc$=""
  205. operator$=""
  206. calc1=0
  207. calc2=0
  208. result=0
  209. end
  210. endif
  211.  
  212. calcmore:
  213. gosub continue:
  214.  
  215. if a$=b$ then
  216. operator$=""
  217. calc$=""
  218. calc1=0
  219. calc2=0
  220. result=0
  221. call "numlockf.exe",""
  222. end
  223. endif
  224.  
  225. if a$="+" then
  226. operator$="+"
  227. return
  228. endif
  229.  
  230. if a$="-" then
  231. operator$="-"
  232. return
  233. endif
  234.  
  235. if a$="*" then
  236. operator$="*"
  237. return
  238. endif
  239.  
  240. if a$=c$ then
  241. return
  242. endif
  243.  
  244. gosub cursor:
  245.  
  246. if a$=d$ then
  247. locate a,c
  248. print e$;
  249. locate a,c
  250. d=len(calc$)
  251. e=d-1
  252. calc$=mid$(calc$,1,e)
  253. if e<0 then
  254. e=0
  255. c=c+1
  256. locate a,c
  257. endif
  258. if b=0 then
  259. a=a-1
  260. b=38
  261. locate a,b
  262. print e$;
  263. locate a,b
  264. endif
  265. goto calcmore:
  266. endif
  267.  
  268. print a$;
  269. calc$=calc$+a$
  270. goto calcmore:
  271.  
  272. rem THIS IS THE END OF THE ROUTINE FOR THE CRAPULATOR (CRAPPY CALCULATOR).
  273.  
  274.  
  275. rem HERE IS THE ROUTINE FOR GENERATING AN ASCII LIST.
  276.  
  277. asciilis:
  278. width 40
  279. print "Here are your options:"
  280. print
  281. print
  282. print "F1- Print the entire list."
  283. print
  284. print "F2- Print one code of your choice."
  285. print
  286. print "Esc- Quit to Main Options Menu."
  287. print
  288. print
  289. print "Please press the key corresponding to"
  290. print "your choice. ";
  291.  
  292. wait:
  293. gosub continue:
  294.  
  295. if a$=b$ then
  296. end
  297. endif
  298.  
  299. if extended=0 then wait:
  300. if a$=";" then printlis:
  301. if a$="<" then printone:
  302. goto wait:
  303.  
  304. printlis:
  305. cls
  306. for c=0 to 255
  307. print c;
  308. print " - ";
  309. a$=chr$(c)
  310.  
  311. if c=0 then
  312. a$=" "
  313. endif
  314.  
  315. print a$;
  316. print " ";
  317. column=column+1
  318.  
  319. if column=3 then
  320. print
  321. column=0
  322. row=row+1
  323. endif
  324.  
  325. if row=20 then
  326. print
  327. print
  328. print "Press any key to continue. ";
  329. gosub continue:
  330. row=0
  331. cls
  332. endif
  333.  
  334. next c
  335. print
  336. print
  337. print "Press any key to return to the Main"
  338. print "Options Menu. ";
  339. gosub continue:
  340. end
  341.  
  342. printone:
  343. width 40
  344. print "Please type the code number of the"
  345. print "character you want to view, from 0 to"
  346. print "255. ";
  347. gosub retypf40:
  348. d=val(file$)
  349. file$=""
  350. if a<0 then printone:
  351. if a>255 then printone:
  352. onecode$=chr$(d)
  353. locate 12,20
  354. print onecode$
  355. print
  356. print
  357. print "Press any key to return to the Main"
  358. print "Options Menu. ";
  359. gosub continue:
  360. end
  361.  
  362. rem THIS IS THE END OF THE ROUTINE FOR GENERATING AN ASCII LIST.
  363.  
  364.  
  365. rem HERE IS THE ROUTINE FOR CHANGING THE DEFAULT DIRECTORY.
  366.  
  367. changedi:
  368. width 40
  369. spaces$=space$(30)
  370. print spaces$;
  371. color 0,7
  372. print "Esc=Quit"
  373. color 7,0
  374. print
  375. print
  376. print "Change Directory"
  377. print
  378. print
  379. print "This option will change the default"
  380. print "directory where The Manager will look"
  381. print "for files if you don't specify the"
  382. print "path.  It's also the directory you'll"
  383. print "be in when you return to DOS, unless"
  384. print "you come back here and change to your"
  385. print "previous directory before exiting.  At"
  386. print "this time, there is no way to change"
  387. print "the default drive."
  388. print
  389. print
  390. print "Directory to change to? ";
  391. gosub retypf40:
  392. directory$=file$
  393. file$=""
  394.  
  395. rechange:
  396. chdir directory$
  397. if error=3 then nopathch:
  398. realdir$=ucase$(directory$)
  399. cls
  400. print
  401. print
  402. print "Your new default directory is"
  403. print realdir$;
  404. print "."
  405. print ""
  406. print ""
  407. print "Press any key to return to the Main"
  408. print "Options Menu. ";
  409. gosub continue:
  410. end
  411.  
  412. rem THIS IS THE END OF THE ROUTINE FOR CHANGING THE DEFAULT DIRECTORY.
  413.  
  414.  
  415. rem HERE IS THE ROUTINE FOR INSTALLING AN AUTOMATIC PARAMETER.
  416.  
  417. install:
  418. width 40
  419. print "This option will install an automatic"
  420. print "parameter.  When you type MANAGER"
  421. print "without any parameters, it will auto-"
  422. print "matically go to this option.  For"
  423. print "instance, if you want to go directly"
  424. print "to the option for deleting files every"
  425. print "time you run The Manager, you can in-"
  426. print "stall that option here."
  427. print
  428. print
  429. print "Press any key to continue. ";
  430. gosub continue:
  431.  
  432. installm:
  433. cls
  434. print "Here are some options you can install:"
  435. print
  436. print
  437. print "F1- Help Screen."
  438. print
  439. print "F2- Delete Files."
  440. print
  441. print "F3- Make Directory."
  442. print
  443. print "F4- Rename Files."
  444. print
  445. print "F5- Get the Time/Date."
  446. print
  447. print "F6- Blank the Screen."
  448. print
  449. print "F7- Check for Graphics Card."
  450. print
  451. print "N- Next Menu."
  452. print
  453. print "Esc- Quit."
  454. print
  455. print
  456. print "Please press the key corresponding to"
  457. print "your choice. ";
  458.  
  459. wait2:
  460. gosub continue:
  461.  
  462. if a$=b$ then
  463. end
  464. endif
  465.  
  466. if a$="n" then instalm2:
  467. if a$="N" then instalm2:
  468. if extended=0 then wait2:
  469. open "o",1,"install.cfg"
  470.  
  471. if a$=";" then
  472. install$="/?"
  473. gosub writeins:
  474. goto writedon:
  475. endif
  476.  
  477. if a$="<" then
  478. install$="/d"
  479. gosub writeins:
  480. goto writedon:
  481. endif
  482.  
  483. if a$="=" then
  484. install$="/m"
  485. gosub writeins:
  486. goto writedon:
  487. endif
  488.  
  489. if a$=">" then
  490. install$="/n"
  491. gosub writeins:
  492. goto writedon:
  493. endif
  494.  
  495. if a$="?" then
  496. install$="/g"
  497. gosub writeins:
  498. goto writedon:
  499. endif
  500.  
  501. if a$="@" then
  502. install$="/b"
  503. gosub writeins:
  504. goto writedon:
  505. endif
  506.  
  507. if a$="A" then
  508. install$="/p"
  509. gosub writeins:
  510. goto writedon:
  511. endif
  512.  
  513. goto wait2:
  514.  
  515. instalm2:
  516. cls
  517. print "Here are more options you can install:"
  518. print
  519. print
  520. print "F8- Blank the Screen."
  521. print
  522. print "F9- Print File."
  523. print
  524. print "<Alt-F1>- Run Other Programs."
  525. print
  526. print "<Alt-F2>- Remove Directory."
  527. print
  528. print "<Alt-F3>- Copy Text File."
  529. print
  530. print "<Alt-F4>- Move Text File."
  531. print
  532. print "<Alt-F5>- Use 80-Column Mode."
  533. print
  534. print "<Alt-F6>- De-install Options."
  535. print
  536. print "Esc- Quit."
  537. print
  538. print
  539. print "Please press the key corresponding to"
  540. print "your choice. ";
  541.  
  542. wait3:
  543. gosub continue:
  544.  
  545. if a$=b$ then
  546. end
  547. endif
  548.  
  549. if extended=0 then wait3:
  550. open "o",1,"install.cfg"
  551.  
  552. if a$="B" then
  553. install$="/s"
  554. gosub writeins:
  555. goto writedon:
  556. endif
  557.  
  558. if a$="C" then
  559. install$="/l"
  560. gosub writeins:
  561. goto writedon:
  562. endif
  563.  
  564. if a$="D" then
  565. install$="/r"
  566. gosub writeins:
  567. goto writedon:
  568. endif
  569.  
  570. if a$="h" then
  571. install$="/e"
  572. gosub writeins:
  573. goto writedon:
  574. endif
  575.  
  576. if a$="i" then
  577. install$="/c"
  578. gosub writeins:
  579. goto writedon:
  580. endif
  581.  
  582. if a$="j" then
  583. install$="/o"
  584. gosub writeins:
  585. goto writedon:
  586. endif
  587.  
  588. if a$="k" then
  589. install$="nothing"
  590. gosub writeins:
  591. goto writedon:
  592. endif
  593.  
  594. if a$="l" then
  595. install$="nothing"
  596. gosub writeins:
  597. goto writedon:
  598. endif
  599.  
  600. goto wait3:
  601.  
  602. writeins:
  603. print # 1, install$
  604. close 1
  605. return
  606.  
  607. writedon:
  608. cls
  609. print "The options you have chosen will now"
  610. print "be run every time you load The Manager"
  611. print "without parameters.  To choose another"
  612. print "option, or to de-install all options,"
  613. print "return to the install menu and press"
  614. print "the appropriate key."
  615. print
  616. print
  617. print "Press any key to return to the Main"
  618. print "Options Menu. ";
  619. gosub continue:
  620. end
  621.  
  622. rem THIS IS THE END OF THE ROUTINE FOR INSTALLING A DOS PARAMETER.
  623.  
  624.  
  625. rem Here is the routine for typing in files in 40-column mode.
  626.  
  627. retypf40:
  628. gosub continue:
  629.  
  630. if a$=b$ then
  631. file$=""
  632. file1$=""
  633. file2$=""
  634. return
  635. endif
  636.  
  637. if a$=c$ then
  638. return
  639. endif
  640.  
  641. gosub cursor:
  642.  
  643. if a$=d$ then
  644. locate a,c
  645. print e$;
  646. locate a,c
  647. d=len(file$)
  648. e=d-1
  649. file$=mid$(file$,1,e)
  650. if e<0 then
  651. e=0
  652. c=c+1
  653. locate a,c
  654. endif
  655. if b=0 then
  656. a=a-1
  657. b=38
  658. locate a,b
  659. print e$;
  660. locate a,b
  661. endif
  662. goto retypf40:
  663. endif
  664.  
  665. print a$;
  666. file$=file$+a$
  667. goto retypf40:
  668.  
  669. rem This is the end of the routine for typing in files in 40-column mode.
  670.  
  671.  
  672. rem Here is the routine for continuing when the user presses a key.
  673.  
  674. continue:
  675. a$=inkey$
  676. if a$="" then continue:
  677. return
  678.  
  679. rem This is the end of the routine for continuing when the user presses a key.
  680.  
  681.  
  682. rem Here is the subroutine for initializing row/column position of cursor.
  683.  
  684. cursor:
  685. a=csrlin
  686. b=pos(0)
  687. c=b-1
  688. return
  689.  
  690. rem This is the end of the routine for initializing cursor position.
  691.  
  692.  
  693. rem .........................................................................
  694.  
  695. rem ERROR ROUTINES
  696.  
  697. rem .........................................................................
  698.  
  699.  
  700. rem Here are the error routines for killfl40:
  701.  
  702. rem File Not Found (Error 2)
  703.  
  704. noflkf40:
  705. file$=""
  706. cls
  707. print "Hi. The file you've specified for"
  708. print "deletion can't be found.  Please check"
  709. print "your spelling and/or path."
  710. print
  711. print "If you want to try again, please"
  712. print "re-enter the file to be deleted.  To"
  713. print "quit and return to the Main Options"
  714. print "Menu, press Esc."
  715. print
  716. print "File to be deleted?"
  717. gosub retypf40:
  718.  
  719. goto rekill40:
  720.  
  721. rem Access Denied (Error 5)
  722.  
  723. ilglkf40:
  724. cls
  725. print "Hi.  You've tried to delete a protect-"
  726. print "ed file.  DOS will not allow this.  In"
  727. print "order to delete it, you'll have to go"
  728. print "to DOS and change your file to read-"
  729. print "write status."
  730. print
  731. print
  732. print "PLEASE NOTE:"
  733. print
  734. print "THIS FILE MAY VERY WELL BE ESSENTIAL"
  735. print "TO THE CORRECT OPERATION OF YOUR COM-"
  736. print "PUTER OR SOME PROGRAM YOU USE REGULAR-"
  737. print "LY.  DELETING IT MAY RENDER YOUR SYS-"
  738. print "TEM OR ONE OF YOUR PROGRAMS UNUSABLE."
  739. print "THAT'S USUALLY THE REASON FILES ARE"
  740. print "PROTECTED WITH READ-ONLY STATUS."
  741. print
  742. print
  743. print "Press Esc to return to the Main"
  744. print "Options Menu or any other key to try"
  745. print "again with a different file. ";
  746.  
  747. gosub continue:
  748.  
  749. if a$=b$ then
  750. end
  751. endif
  752.  
  753. goto delagn40:
  754.  
  755. rem This is the end of the error routines for killfl40:
  756.  
  757.  
  758. rem THIS IS THE ERROR ROUTINE FOR PATH NOT FOUND (CHANGEDI:)
  759.  
  760. nopathch:
  761. cls
  762. print "Hi.  The path you've specified can't"
  763. print "be found.  Please check your spelling"
  764. print "and path and try again.  To quit and"
  765. print "return to the Main Options Menu, press"
  766. print "Esc at any time."
  767. print
  768. print
  769. print "Directory to change to? ";
  770. gosub retypf40:
  771. directory$=file$
  772. file$=""
  773. goto rechange:
  774.  
  775. rem THIS IS THE END OF THE ERROR ROUTINE FOR PATH NOT FOUND (CHANGEDI:)
  776.  
  777.  
  778. rem .........................................................................
  779.  
  780. rem THIS IS THE END OF THE ERROR ROUTINES.
  781.  
  782. rem .........................................................................
  783.  
  784.  
  785. end
  786.