UPDATED!!!Please note, this is now version 2.0!
Changes:
You can now add $filename="your filename" to the command line.
IF EXIST checking on $filename
I wrote this to monitor a text file generated by a server.
I hope someone else finds it useful.
cj
code:
break on
;
; ShowFile
$version = "Version 2.0"
; by cj
;
; This will periodically update the screen with the contents of a file
; allowing you to monitor things like...
;
; on a remote computer put this in a KiX script:
;
; shell "%comspec% /c echo blah blah blah >>\\yourcomputer\share\filename"
;
; The remote computer will APPEND (>> ) this text to your file and you will see
; it no more than $delay seconds later
;
$delay = 1 ; refresh delay in seconds
$clear = "" ; "" = delete, "not" = not delete file, just clear screen
;--------------------------------------------------------this is the line, you know the rules...
; open DLL, and quit if it is not found. You can get this from http://kix.isorg.net/
$kixlib=olecreateobject("kixlib32.library") if $kixlib=0 "KIXLIB32 not installed" ? quit endif
cls
"SHOWFILE $version by cj" ? ?
"Update delay is $delay second" if $delay<>1 "s" endif ?
"Clear option will $clear" if $clear<>"" " "endif "delete the file" ?
while exist("$filename")=0 ? "Enter the full path to the file to display: " gets $filename loop
:top
cls
"SHOWFILE $version by cj" ?
"ESC = quit ENTER = new line SPACE = clear"
:again
at(3,0)
$=open(1, $filename)
readline(1) do readline(1) ? until @error<>0 ; dump file contents
$=close(1)
if olecallfunc($kixlib,"kbhit")=1
get $key
if $key=chr(13) shell "cmd /c echo. >> $filename" endif
if $key=chr(27) ? ? "Goodbye!" ? quit endif
if $key=" "
if $clear=""
del "$filename"
$=open(1, $filename, 5)
$=writeline(1, chr(13)+chr(10))
$=close(1)
endif
goto top
endif
endif
sleep 1
goto again
[This message has been edited by cj (edited 13 February 2001).]