#!/bin/tcsh -f #(ie run the cshell on this but don't read the .cshrc) set v = "version = 2.23 of slideshow 2019 Mar 04: make a slide show" # 2019 Mar 04, 2.23: alt tags remove '<>' to avoid links # 2011 Aug 17, 2.22: cleanup # 2011 Aug 17, 2.21: fixing bugs # 2011 Aug 17, 2.20: .alt files override .txt: Alttag # 2011 Jul 25, 2.19: add alt to img of each html page. # 2011 Jul 25, 2.18: add alt to img of thumbs. open script instead of netscape # 2009 Aug 15, 2.17: don't make a thumnail of a thumbnail! # 2003 Jul 24, 2.16: if cannot identify as photo - don't make photo. # 2003 Jun 11, 2.15: -shownames # 2003 Jan 26, 2.14: switch from csh to tcsh to make a more robust program # 2003 Jan 26, 2.13: allow background control in image .txt files # 2003 Jan 23, 2.12: -listnames option to give names of images # 2003 Jan 22, 2.11: fix usage display # 2002 Dec 15, 2.09: on Mac OSX image names burn to CD in lower case! # 2002 Dec 15, 2.08: thumb names have dots changed to '-'. # 2002 Dec 15, 2.07: HTML names do not have two dots, first one is '-'. # This is necessary because on the Mac OSX the first # dot gets REMOVED when one burns a CD. Of course # that wrecks the HTML links! # 2002 Dec 15, 2.06: slideshow announces version when giving usage # 2002 Dec 15, 2.05: popup names made sensible # 2002 Oct 11, 2.04: small and adjustable headerless popup image # 2.03, 2002 Oct 11: bug fix: number of arguments < 2, not < 3! # 2.02, 2002 Jul 23: -thumbnail option # 2.01, 2002 Jul 23: image source directory must be specified # 2.00, 2002 Jul 23: mouse square is off normally, -mouseon flag to turn on # 1.99, 2002 Feb 19: mouse square has black border # 1.97, 2002 Feb 19: font controls # 1.96, 2001 Nov 5: first link on black background is first slide # 1.95, 2001 Nov 5: list of all slides: only one copy of txt # 1.94, 2001 Nov 5: target reference from page # 1.93, 2001 Nov 5: identify version on top of screen # 1.92, 2001 Nov 5: use identify -ping to get image size faster! # 1.91, 2001 Aug 2: install switch to allow .htm instead of .html # 1.89, 2001 Aug 1: allow nonimage ascii (ie html) files to be used # 1.88, 2001 Aug 1: No images in list file still gives web page but with warning # 1.86, 2001 Jul 27: .txt option in slide list # 1.86, 2001 Jul 26: documentation of new print option # 1.84, 2001 Jul 26: use netscapesave to print the slideshow in PostScript! # 1.83, 2001 Jul 26: bug fix: legends duplicate if images = "." # 1.82, 2001 Jul 18: cleanup # 1.81, 2001 Jul 18: fix bug - show starts now! regularize output display # 1.78, 2001 Jul 18: image.type.txt file in html directory too. # 1.77, 2001 Jul 18: ability to control link colors in .txt file # 1.76, 2001 Jul 18: ability to control background color in .txt file # 1.75, 2001 Jul 18: full slide names (1.html -> base.1.html) # 1.72, 2001 Jul 18: legend goes above control bar # 1.71, 2001 Jul 17: spaces in slide list allowed # 1.62, 2001 Jul 11: timer, slide image popups. # 1.45, 2001 Jul 9: mouse pointer can be turned off with variable # 1.44, 2001 Jul 9: javascript for steady mouse pointer # 1.40, 2001 Jun 27: popup blank page, clean documentation # 1.26, 2001 Jun 26: nonframe version, detects image width/height # 1.16, 2001 Jun 25: frame version # 1.15, 2001 Jun 21: non frame version # origin 2001Jun20.21:12:20 # %23456789 123456789 # 1 2 set version = "$v" # capture the version number set versionnumber = `echo $version | cut -c10-14` # echo $versionnumber # Thomas D. Schneider, Ph.D. # Senior Investigator # National Institutes of Health # National Cancer Institute # Center for Cancer Research # RNA Biology Laboratory # Biological Information Theory Group # Frederick, Maryland 21702-1201 # schneidt@mail.nih.gov # https://alum.mit.edu/www/toms # ****************************************************************************** # DEFAULT PARAMETERS # set to "true" to create frames: set doframes = "true" set doframes = "false" # Note: doframes = true is not functional, do not set to true. # set to "true" to create mouse pointer: set mousepointer = "true" set mousepointer = "false" # define temporary mouse pointer files set mp0 = .mousepointer.startpage set mp1 = .mousepointer.head set mp2 = .mousepointer.body set thumbnail = "false" set listnames = "false" set shownames = "false" # program to open an html page (works on Mac OS X): set browse = open # ****************************************************************************** # Set up keyword for searches in the .txt files for commands. # It should be a word that is unlikely to be used! set keyword = 'SlideShow:' # ****************************************************************************** # Set the percent of vertical height to use for slide. # This allows the back, slides and forward pointers to have room # (i.e., setting height to 100% allows the image to occlude them). # The horizontal is also given for completeness but is usually 100%. set verticalpercent = 88 set horizontalpercent = 100 # ****************************************************************************** # default for "headerless image" size when it is just html set defaultswidth = "700" set defaultsheight = "800" # set defaultswidth = "400" # set defaultsheight = "400" # ****************************************************************************** # Under Disasterous (or Dumb) Operating System (DOS) file # name extensions cannot be longer than 3 characters. That # means that if the slide show is put onto a DOS floppy, for # example, the l of 'html' will be lopped off and the hyptertext # pointers will fail. To allow for this, the $html variable # can be set. # The second of the two following lines is the final one set # and so determines the extension. Merely switch the lines # to change the state. In vi, go to the top line and 'ddp'. set html = htm set html = html # hhh # ****************************************************************************** if ($#argv == 0) then # ****************************************************************************** # ****************************************************************************** # ***** DOCUMENTATION ABOUT HOW TO USE THE PROGRAM ***************************** # ****************************************************************************** # ****************************************************************************** set f = 'fVALUE' set lower = 'lowerVALUE' more << EOF $version usage: slideshow [slidelist] [slidelist.html] [image source directory] [...] [slidelist]: an ascii file containing a list of the image files [slidelist.html]: name of the starting page [image source directory]: directory where the images are kept [...] additional controls: "-font areal 4" set the font to areal size 4 "-mouseon" turn on red square next to mouse arrow "-thumbnail 5" images on main page are thumbnails, 5% of original size "-listnames" list the number and name of each image on the first page to allow easy organization of the images. "-shownames" replace the words 'image popup' with the name of the image on each page. slideshow is a Unix csh script that generates an html slide show from a set of images. Just create a set of image files that your browser can handle. Then create a file that lists the file names. Run this slideshow script. A series of html pages will be created that step through the slides. These pages can be viewed in any browser. Just click on an image to get to the next one, or use the "back", "slide list" and "forward" buttons. Notes: 1. The images are not duplicated, so you can reuse slides if you want without wasting space. Slideshow does not modify the images in any way. 2. The last slide points to the slide list page. 3. Comments may be placed in the slidelist as lines that begin with "#". The input file can have blank lines in it. 4. Figure legends can be added to images. For example, if there is a file x.jpg in the directory "images", then the contents of the text file "images/x.jpg.txt" will be added below the figure. The text may contain html instructions. Since one may want to have a directory of images about which one says different things, IF there is an image "images/x.jpg" then both "images/x.jpg.txt" and "./x.jpg.txt" will be used (in that order). That is, x.jpg.txt can be in the current directory (ie ".") OR in the image source directory. 5. When the slides appear on the start page, they are loading into the browser cache. Once this is complete, one can lose connection to the slide source and still view the slides. 6. Because the slides are stored in the browser cache, if you revise the slides (for example by substitution or exchange) then you will need to refresh the relevant slide pages (reload with shift held down on Netscape) OR you can clear your cache (found under edit, preferences, advanced, cache). 7. A blank.html file is also generated. This can be used in a browser as a black background to cover other junk on the screen. If your browser handles javascript, then one can also get a version of the blank page without header stuff. A clock (from www.time.gov) is available. 8. Since each slide is a pointer to the next slide, the 'pointer' may not be clearly visible on some operating systems. If the flag -mouseon is given, a small red box will appear at the position of the mouse. 8. If the flag -thumnail is given, the images on the main slide page will be thumbnails. It takes a while to generate thumbnails BUT this means that the main page will show quickly. However, the person watching the slide show has to take more time to get the larger image. The advantage of NOT doing thumbnails is that the original images are used on the main page and they are only displayed as small. This takes a while to show the first time BUT it loads the images into the browser which should speed the show. To save time, thumbs are only created once. If you decide that you want a different size thumbnail, you must remove the thumbnails from the image directory. 9. To control the background color, use a .txt file in the current directory or the image directory containing an html comment containing one or more control lines: 10. Image alt tags are in derived this order from: [imagename].alt [imagename].txt ALTERNATE_TEXT The keyword "$keyword" must be followed by exactly ' bgcolor' and then by the color. Controls available are: bgcolor set background color text set text color link set link color alink set link color while mouse button is down vlink set link color after being followed Standard names for colors can be used, or the form #RRGGBB may be used, where RR is the amount of red, GG green and BB blue. The two digits are in hexadecimal, running 0 to 9 and A to F (16 symbols). For example, #FF00FF is a purple color made by combining red and blue. If you have commands in .txt files in both the image and current directory, the current directory .txt file will have priority. 10. The program provides two options for printing. The first is a straight list containing all html files. This probably will never print properly. The second is a csh script named '[slidelist.html].PRINT'. It will control Netscape to create postscript files of each page. It then calls a script, 'printps' that will print the pages. You must write 'printps' yourself to fit your computer system. It may be as simple as: lp -d [printername] Be sure that it can be executed by typing 'chmod a+rx printps'. You can run the print script by typing '*.PRINT'. 11. You may include slides created purely out of html simply by listing them in the list. 12. On Mac OS X, image names burn to CD in lower case! This wrecks the html pointers. However the rule of this program is that images are not modified. So to burn a CD on the Mac, you should convert all file names to lower case. A script (which can be called mklower) will do the trick: EOF # this has to be done outside the more to prevent EXECUTION # of the code! echo 'foreach f (`ls`)' echo ' set lower = `echo $f | tr "[:upper:]" "[:lower:]"`' echo ' if ($f != $lower) then' echo ' echo mv $f $lower' echo ' mv $f $lower' echo ' endif' echo 'end' more << EOF 12. If the flag -listnames is given, the images on the main slide page will be given one per line along with the actual image name. This allows one to organize the slide order 13. If the flag -shownames is given, the name of the file containing the image replaces 'image popup' on the page. ------ Further Information: source of this csh script: http://alum.mit.edu/www/toms/ftp/slideshow web page: http://alum.mit.edu/www/toms/slideshow/ The program uses browse: http://alum.mit.edu/www/toms/ftp/browse to set your browser to the slideshow start point. The program uses browse: http://alum.mit.edu/www/toms/ftp/browse to have your browser print the html pages into PostScript. The program uses the ImageMagick (http://www.imagemagick.org/) program "identify" to determine the size of images. If the height is larger than the width, then the height is used to fill the screen, and vice versa for the width. see also http://alum.mit.edu/www/toms/ftp/browse http://alum.mit.edu/www/toms/atchange.html Author Thomas D. Schneider, Ph.D. Senior Investigator National Institutes of Health National Cancer Institute Center for Cancer Research RNA Biology Laboratory Biological Information Theory Group Frederick, Maryland 21702-1201 schneidt@mail.nih.gov https://alum.mit.edu/www/toms EOF # Technical notes # The trouble with the frames is that they don't work the same # on a Mac running Netscape 4.7 as with a Sun running netscape 4.7. # That is, the sizing will work on a Mac but not the Sun. # Therefore it is best to make a simple html which will work everywhere. # ****************************************************************************** # ****************************************************************************** # ***** END OF DOCUMENTATION ABOUT HOW TO USE THE PROGRAM ********************** # ****************************************************************************** # ****************************************************************************** exit else echo "$version" endif # make sure that the identify program is available: # if (`which identify | tr " " "\n" | head -1` == "no") then if (`which identify | grep '/' | wc -l` == "0") then # lllimagemagick # NOPE, not a command set canidentify = "NOPE" echo '**** slideshow: WARNING ***********************************************' echo 'Slideshow uses the ImageMagick (http://www.imagemagick.org/)' echo 'program "identify" to determine the size of images.' echo 'You *MUST* have it for slideshow display images properly\!' echo '(Besides, ImageMagick is fantastic :-)' echo "***********************************************************************" else set canidentify = "YUP" endif echo "Can identify images: $canidentify" # start analysis of arguments set list = $1 if !(-f $list) then echo 'the list file "'$list'" does not exist.' exit endif # We need at least the two arguments if ($#argv < 2) then # recursively call the program to get the help message!! slideshow exit endif if ($2 == $1) then set startpage = $1.$html echo "WARNING\! Using $startpage for the html output" else set startpage = $2 endif # set base = `echo $startpage | sed -e "s/\.$html//"` set startpagebase = `echo $startpage | sed -e "s/\.$html//"` # echo $startpagebase echo "-----------------------------------------------" echo "The list of images is in file ........'"$list"' (input)" echo "The starting html page is ........... '"$startpage"' (input)" # Individual Slide Page (isp) for printing set isp = "$startpagebase"-isp.$html echo "The Individual Slide Page will be ... '"$isp"'" echo "The keyword for .txt commands is .... '"$keyword"'" echo "-----------------------------------------------" if ($#argv > 2) then set images = $3 if (-d $images) then echo Image directory: $images else echo 'The requested image directory $images does not exist\!' endif else echo The current directory will be used for the images. set images = '.' endif # analyze flag arguments set fontface = "" set fontsize = "" set fontbeg = "" set fontend = "" if ($#argv > 3) then @ argument = 4 while ($argument <= $#argv) echo argument "$argument": $argv[$argument] if ("$argv[$argument]" == "-font") then @ need = $argument + 2 if ($#argv < $need) then echo "missing arguments for '-font'" exit endif @ argument++; set fontface = $argv[$argument] @ argument++; set fontsize = $argv[$argument] echo font: $fontface $fontsize set fontbeg = '' set fontend = '' endif if ("$argv[$argument]" == "-mouseon") then set mousepointer = "true" echo mousepointer is on endif if ("$argv[$argument]" == "-thumbnail") then set thumbnail = "true" @ need = $argument + 1 if ($#argv < $need) then echo "missing arguments for '-thumbnail'" exit endif @ argument++; set scale = $argv[$argument] echo thumbnails will be created at "$scale"% original size set scalefactor = `echo "$scale"%x"$scale%"` echo $scalefactor #exit endif if ("$argv[$argument]" == "-listnames") then set listnames = "true" echo listnames is on endif if ("$argv[$argument]" == "-shownames") then set shownames = "true" echo shownames is on endif @ argument++ end endif set blank = "blank.$html" # find number of slides from the list # this counts blank lines!! # set n = `cat $list | grep -v "#" | wc -l | cut -c 1-8 | sed -e "s/ //g"` set counter = 0 foreach s (`cat $list | grep -v "#"`) @ counter ++ if (-f $images/$s.txt) then echo -n "L " else echo -n " " endif if (-f $s.txt) then echo -n "l " else echo -n " " endif if (-f $images/$s) then echo -n $counter $images/$s # # detect ascii file set ascii = `file $images/$s | grep -c 'ascii'` set empty = `file $images/$s | grep -c 'empty'` # if (`file $images/$s | grep -c 'ascii'` == 1) then if ($ascii || $empty) then # if (`file $images/$s | grep -c 'ascii'` == 1) then # OLD if (`echo $s|grep -c '.html'` == 1) then echo -n " => ASCII (HTML) slide" endif else echo -n $counter 'WARNING\! There is no image file "'$images/$s'".' endif echo "" end echo "Key:" echo "L = has a '.txt' legend in the $images" directory echo "l = has a '.txt' legend in the current (ie "'"."'") directory" @ n = $counter echo "-----------------------------------------------" echo "There are $n slides given in $list" if ($n < 1) then echo "No slide show is possible without images." set isimage = 'false' else set isimage = 'true' endif #********************************************************************* # printing # lllprintslideshow: Location Location Location marker # define the script to be made that prints the slide show set printslideshow = $list.PRINT set printer = printps # check that the user has browse ready to run # if (`which $browse | tr " " "\n" | head -1` == "no") then if (`which $browse | grep '/' | wc -l` == "0") then # NOPE, not a command echo "************************* WARNING *************************************" echo "* Slideshow requires browse:" echo "* http://alum.mit.edu/www/toms/ftp/browse" echo "* to have you browser print the html pages into PostScript." echo "* You must obtain it to have this feature." echo "***********************************************************************" set cansave = "NOPE" else if (`which printps | grep '/' | wc -l` == "0") then # NOPE, not a command echo "************************* WARNING **********************************" echo "* Slideshow requires printps," echo "* which is a script you must write yourself that will" echo "* print postscript files to a printer." echo "* You must create printps in order to print the slideshow to a printer." # echo "* An example printps is at:" # echo "* http://alum.mit.edu/www/toms/ftp/printps" echo "********************************************************************" set cansave = "NOPE" else # YUP, it's a command set cansave = "YUP" echo "********************************************************************" echo "** The script $printslideshow will print all slides" echo " $printslideshow" echo "** will print all slides using the $printer script" echo "********************************************************************" # printing echo "#\!/bin/csh -f" > $printslideshow echo "#(ie run the cshell on this but don't read the .cshrc)" >> $printslideshow echo "" >> $printslideshow echo "# $printslideshow was automatically created by:" >> $printslideshow echo "# $v" >> $printslideshow echo "# The source of slideshow is:" >> $printslideshow echo "# http://alum.mit.edu/www/toms/slideshow/" >> $printslideshow echo "# $printslideshow is a csh script that requires" >> $printslideshow echo "# two other scripts:" >> $printslideshow echo "# http://alum.mit.edu/www/toms/ftp/browse" >> $printslideshow echo "# printps (your own printing script)" >> $printslideshow echo "" >> $printslideshow echo "echo '"$printslideshow"'" >> $printslideshow echo "echo 'printing the "$list" slide show'" >> $printslideshow # print the thumbnails on the first page: echo "" >> $printslideshow echo "browse $startpage " >> $printslideshow echo "printps $startpage.ps" >> $printslideshow chmod u+x $printslideshow endif endif # ****************************************************************************** if ($mousepointer == "true") then echo mousepointer is ON echo temporary files: $mp0, $mp1, $mp2 endif # set up mouse pointer files cat > $mp0 << EOF
EOF endif if ($isimage == 'false') then echo '' >> $startpage echo "There are no images listed in file '"$list"'." >> $startpage echo '' >> $startpage endif #* Start individual slide page *************************************** cat > $isp << EOF
EOF if ($mousepointer == "true") then cat $mp0 >> $startpage endif cat >> $startpage << EOF START SLIDE SHOW Launch blank background browser. This should work on any browser but will not give full screen coverage.* Popup blank background browser. This gives full screen coverage but depends on javascript so may not work on all browsers. Click on the link to get this page to begin the slide show.*
Printing options:
This slide show was created
on
$date
by the slideshow script:
$version
http://alum.mit.edu/www/toms/ftp/slides
http://alum.mit.edu/www/toms/slideshow
author:
Tom Schneider
with header | with NO header |
FIRST SLIDE, | EOF echo -n '> $blank cat >> $blank << EOF >FIRST SLIDE |
SLIDES, | EOF echo -n '> $blank cat >> $blank << EOF >SLIDES |
www.time.gov | www.time.gov |
Clock, | Tiny Clock |