#!/bin/sh # Example shell script for using the output from Screen-Shooter # If this is ugly, its because my shell scripting is worse than my C # programming, which is bad enough to start with ;) # If you improve this script, could you send me the results? # Change these variables to reflect the location of your web-page # The page doesn't need to exist, but if it does, stuff is added to it SCREENSHOTPAGE=screenshots.html WEBSITEDIR=~/ SCRSHOT=$1 [ -z $2 ] && { THUMB="" } || { THUMB=$2 } cd $WEBSITEDIR [ -f "$SCREENSHOTPAGE" ] && { FILE_EXISTED=TRUE # Create backup of existing file if it exists mv $SCREENSHOTPAGE ${SCREENSHOTPAGE}_OLD # Rip the headers out of the file if it exists. # Replace , but I didn't want # to enforce the alteration of existing pages. Its easier to change the # script. This script just sticks the new image in after the tag. sed '/ $SCREENSHOTPAGE } || { # Otherwise, (page doesn't already exist), create basic headers. # Feel free to alter these to suit yourselves echo "" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE echo -n "> $SCREENSHOTPAGE echo "charset=iso-8859-1\">" >> $SCREENSHOTPAGE echo "Screenshot Page created by the Screen-Shooter Applet" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE } # Add the image to the page. Feel free to change this bit, change the alt # text, add a default size (a percentage of your resolution for example), # some text, and any other stuff you add on a per-shot basis. echo "" >> $SCREENSHOTPAGE echo -n "> $SCREENSHOTPAGE echo -n $SCRSHOT >> $SCREENSHOTPAGE echo -n "\" target=\"main\">> $SCREENSHOTPAGE echo -n $THUMB >> $SCREENSHOTPAGE echo -n "\" border=\"0\" alt=\"Screenshot. Taken using Screen-Shooter\"" >> $SCREENSHOTPAGE echo " align=\"left\">" >> $SCREENSHOTPAGE echo -n "Screenshot captured on " >> $SCREENSHOTPAGE echo `date +%d-%m-%y` >> $SCREENSHOTPAGE echo "
" >> $SCREENSHOTPAGE echo "
" >> $SCREENSHOTPAGE echo "

" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE [ -z $FILE_EXISTED ] && { # We've created a new html file, so we'll need to terminate it correctly. # Add some default stuff to the end. echo "" >> $SCREENSHOTPAGE echo "" >> $SCREENSHOTPAGE } || { # This is an addition to an existing page, so # add the rest of the page back on to the end. sed -n '//,//p' ${SCREENSHOTPAGE}_OLD | grep -v "" >> $SCREENSHOTPAGE } # If you want, you can keep the backup by commenting out this line.... rm -f ${SCREENSHOTPAGE}_OLD