#!/bin/csh -f #(ie run the cshell on this but don't read the .cshrc) if ($#argv == 0) then echo "version = 1.04 of vh 1997 Jan 14" # run vi on an html file; make netscape go to that page! # Make netscape refresh every time you write the file out! echo "usage: vh [filename|filename.html]" echo "" echo "vh will add an .html extension if you don't type it" echo "vh will create a starter filename.html if it does not exist." echo "Netscape will be pointed to the filename.html" echo "then you will be put into vi on the filename.html" echo "Whenever you write out the file, Netscape will update\!" echo "" echo "For further information, see" echo "http://www-lmmb.ncifcrf.gov/~toms/atchange.html" echo "" echo "Tom Schneider" echo "National Cancer Institute" echo "Laboratory of Mathematical Biology" echo "Frederick, Maryland 21702-1201" echo "toms@ncifcrf.gov" echo "http://www-lmmb.ncifcrf.gov/~toms/" echo "" else echo ----------------------- setting up to control netscape! echo input argument 1 is: $1 echo # add .html and remove any resulting .html.html: set rawfilename = `echo $1.html | sed -e "s/.html.html/.html/"` echo rawfilename is: $rawfilename # make the full path file name from the raw file name set fullpathfilename = `pwd`/$rawfilename echo fullpathfilename is: $fullpathfilename # make a blank html document to start with # if it didn't exist before! if !(-f $fullpathfilename) then echo '' >> $fullpathfilename echo 'zzzFIXthisTITLE' >> $fullpathfilename echo '' >> $fullpathfilename echo '' >> $fullpathfilename echo '> $fullpathfilename echo 'bgcolor="#ffffff"' >> $fullpathfilename echo ' text="#000000"' >> $fullpathfilename echo ' link="#0000ff"' >> $fullpathfilename echo ' alink="#00ff00"' >> $fullpathfilename echo ' vlink="#ff0000"' >> $fullpathfilename echo '>' >> $fullpathfilename echo '' >> $fullpathfilename echo '' >> $fullpathfilename echo '' >> $fullpathfilename echo '

' >> $fullpathfilename echo 'zzzFIXthisTITLE' >> $fullpathfilename echo '

' >> $fullpathfilename echo '' >> $fullpathfilename echo 'zzzPUTsomethingHERE' >> $fullpathfilename echo '' >> $fullpathfilename echo '
' >> $fullpathfilename endif # set up a file in /tmp set tmpcmds = /tmp/`whoami`.$rawfilename.vh # make the file in /tmp to control netscape: echo "netscape -noraise -remote 'openFile($fullpathfilename)'" > $tmpcmds chmod u+x $tmpcmds # tell me about the file: echo tmpcmds is: $tmpcmds echo the file $tmpcmds contains: cat $tmpcmds # run the /tmp file to make netscape go to the desired document: set dummy = `$tmpcmds` # rewrite the file in /tmp to be used by atchange echo "$fullpathfilename netscape -noraise -remote 'reload'" > $tmpcmds echo "echo $fullpathfilename was reloaded into netscape" >> $tmpcmds # slow it down a bit so Netscape only refreshes once (for small files) echo "sleep 1" >> $tmpcmds # cat $tmpcmds # spawn a right-side window running the atchange of $tmpcmds # topright "atchange $tmpcmds" # that would work but the window comes up and it doesn't help much, so # do the same command as topright, but with -Wi to make it start iconified toprightclosed "atchange $tmpcmds" echo ----------------------- Setup completed! # echo ----------------------- Setup completed! # finally, run vi on the file: vi $fullpathfilename echo clean up /tmp ... rm -f $tmpcmds echo vh is done. endif