KDE Screenshot-FTP-O-Matic

Automatically create screenshot of window (or desktop) in KDE and upload it into a FTP directory. Additionally, put the WWW URL of the screenshot into the clipboard (klipper) so that it can be easily pasted into any application (e.g. KMail).

This probably requires KDE 3.2 or greater (because of kdialog) but maybe it works with oder versions by replacing the kdialog commands with static values or some other dialog type application.

If you select "window" ("No"), you will have to click on the window you want to make the screenshot of.

#!/bin/bash
# Published under GPL by Jens Benecke <jens at spamfreemail.de> in 2004.

WWWSITE=http://www.jensbenecke.de/temp          # where will the image be viewable?
FTPSITE=ftp://phpwiki@jensbenecke.de/temp       # FTP address used to change your website

test -z "$DISPLAY" && (echo "No X display found"; exit 1 )
kdialog --yesnocancel "Screenshot Menu: Fullscreen (Yes), Window (No), or Cancel?" ; R=$?
case $R in
        0)      F="-root";;
        1)      F="-frame";;
        2)      exit 1;;
esac
xwd $F | convert - /tmp/shot.png
FILE=$(kdialog --inputbox "Dateiname für $WWWSITE/..." "`date +%Y-%m-%d__%H.%M.png`")
test -z "$FILE" || kfmclient copy /tmp/shot.png "$FTPSITE/$FILE"
dcop klipper klipper setClipboardContents "$WWWSITE/$FILE"

Update: Save locally or via FTP, and use a different screenshot utility

#!/bin/bash
# Published under GPL by Jens Benecke <jens at spamfreemail.de> in 2004.

WWWSITE=http://www.jensbenecke.de/temp          # where will the image be viewable?
FTPSITE=ftp://phpwiki@jensbenecke.de/temp       # FTP address used to change your website
DATE="`date +%Y-%m-%d__%H.%M.png`";             # Default file name
TMPFILE=`mktemp /tmp/shot.XXXXXX`.png

test -z "$DISPLAY" && (echo "No X display found"; exit 1 )
kdialog --yesnocancel "Screenshot Menu: Fullscreen (Yes), Window (No), or Cancel?" ; R=$?
if [ $R == 0 ] ; then F="-window root"; else F=""; fi
rm -f $TMPFILE
# xwd $F | convert - $TMPFILE
import $F $TMPFILE
kdialog --yesno "FTP upload (Yes) or save locally (No)?" ; F=$?
if [ $F == 0 ] ; then FILE="$FTPSITE/$DATE"; else FILE="./$DATE"; fi
TARGET=$(kdialog --getsaveurl "$FILE")
test -z "$TARGET" && (kdialog --error "File name is empty! Exiting." ; exit 1 )
kfmclient copy $TMPFILE "$TARGET" ; C=$?
test $C == 0 || ( kdialog --passivepopup --title "Copying screenshot to destination failed!" "Bailing out."; exit 1 )
test "$F" -eq "0" && test "$C" == 0 && dcop klipper klipper setClipboardContents "$WWWSITE/`basename $TARGET`"

Updates

JensBenecke