home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / batnmore.z!p / CTRL-L.BTM < prev    next >
Text File  |  1992-11-15  |  4KB  |  99 lines

  1. *REM This batch file is Freeware, free to use and redistribute unmodified *
  2. *REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
  3.  
  4. REM Clear screen while preserving command line as it is.
  5. REM Timestamp 15-Nov-1992
  6.  
  7. REM Note: *must* disable before using any program. Use at your own risk.
  8. REM Note: there are a lot of troubles here, check end of this file.
  9.  
  10. REM Need ANSI.SYS compatible driver being able to redefine keyboard keys
  11. REM and a grep command (you might want to replace it with find).
  12.  
  13. iff %_ansi==0 then^echo Need ANSI device driver^goto end^endiff
  14.  
  15. REM iff "%@search[find]"=="" then^echo Need FIND command^goto end^endiff
  16. iff "%@search[fgrep]"=="" then^echo Need FGREP command^goto end^endiff
  17.  
  18. REM Is insert ON/OFF? Let's hope default setting is current setting, too.
  19. REM setdos|*find "MODE="|set INSERT=%@substr[%@line[con,0],0,-1]
  20.  
  21. setdos|*fgrep -csx1 "MODE="|set INSERT=%@substr[%@line[con,0],0,-1]
  22. iff "%INSERT"=="0" then^set INSERT=;0;82;^else^set INSERT=;^endiff
  23.  
  24. REM enable unixlike control-l. Note: *never* use inside any program. Never.
  25.  
  26. iff %@len[%@alias[·]] == 0 then
  27.  echos e[12;0;79;32;32;32;32;32;0;71%[INSERT]250;11;"·";13p
  28.  alias ·=keystack "*cls" 13 @73 10 @73 4 8 8 8 8 8 @71 @83 @79
  29.  echo Unixlike Ctrl-L ON
  30.  echo e[0;1;5;31;40m
  31.  echo ╔════════════════════════════════════════════════════════════════════════════╗
  32.  echo ║ e[0;1;37;40mNote: e[33m*must*e[37m be disabled before starting any program. e[33mUse at your own risk.e[5;31;40m║
  33.  echo ╚════════════════════════════════════════════════════════════════════════════╝
  34.  echos e[0m
  35.  
  36. else
  37.  
  38. REM disable unixlike control-l
  39.  
  40.  echos e[12;12p
  41.  unalias ·
  42.  echos Unixlike Ctrl-L OFF
  43. endiff
  44.  
  45. :end
  46. quit
  47.  
  48. REM troublestroublestroublestroublestroublestroublestroublestroublestroubles:
  49.  
  50. REM problem1: what if command line is empty?
  51.  rem easy to fix, but depends on HistMin, which is.. now hardcoded to le 6
  52.  
  53. REM problem2: what if there is another command just alike? how exit history?
  54.  rem use unlikely chars, but what is unlikely somewhere else? Works here.
  55.  
  56. REM problem3: what if command is preceded by "@" and doesn't get recorded?
  57.  rem always insert 1 char in front (why not more? flickering..)
  58.  
  59.  rem problem w/all above is limited command line lenght. Not likely to occur,
  60.  rem but if it does, control-l refuses to work, thanx to 4DOS.
  61.  
  62. REM problem4: is Insert on or off?
  63.  rem now hoping default setting is a correct guess.
  64.  rem if guessed wrong, will delete first character on command line.
  65.  
  66. REM problem4: how do I know, if key redefinition is allowed?
  67.  rem ...
  68.  
  69. REM trouble1: screen flickering (maybe e[8m etc.?). getting serious.
  70.  rem can I reduce size of history window? hide it? re-set screen contrast?
  71.  
  72. REM trouble2: how to select unique alias name? Now hardcoded to "·"
  73.  rem could try to misuse %@time[] in a loop until unique alias name found
  74.  rem then had to write that alias name into this file to remember it
  75.  
  76. REM Why Ctrl-Enter aka Ctrl-j doesn't work in string to-be-echoed?
  77. rem  echos e[12;32;32;32;32;32;0;71;0;82;250;11;"*cls";13;0;73;10;0;73;4;8;8;8;8;8:0;71;0;83;79;13p
  78. rem  alias tmps=1
  79. rem  maybe fixed in 4dos 4.01 rev D ?
  80.  
  81. REM WARNING: Why it is dangerous to use this batch file *and* start a program?
  82.  
  83. rem Because after you have run this batch file once, control-l is no more just
  84. rem control-l, but instead a command string, which includes cursor movements,
  85. rem character inserting and character deleting. When you run this batch file
  86. rem for the second time, control-l will be restored back to just control-l.
  87.  
  88. REM Note: some Trojan Horses use key redefinition to erase hard disks.
  89.  
  90. rem If you have ANSI.SYS driver, which allows keyboard redefinition, *never*
  91. rem "type" text files, always use text editor/viewer until you know there are
  92. rem no suspicious ANSI escape sequencies. And read batch files before running
  93. rem them. If you can't find out exactly what they do, don't run them. Do you
  94. rem know what this batch file does? 4DOS has build-in "list" file viewer.
  95.  
  96. rem nnans992.zip is extremely fast ansi.sys replacement, which by default
  97. rem *does not* allow keyboard redefinitions. Home users encouraged, business
  98. rem users required US$10 right-to-use license. Check SIMTEL20 msdos/screen/
  99.