PDA

View Full Version : HOWTo take screenshot and upload to ftp automatically



grizzly
September 12th, 2006, 01:24 PM
My first HOWTo!! - hope it helps :)
I have tried to make it as easy as possible for those unfamiliar with ftp, suggest any improvements plz.

Step 1. Install the apps:

sudo aptitude install ncftp scrot

Step 2. Get the script > save it as 'shoot' > make it executable > put it in your path /usr/bin

Step 3. Get yourself a free ftp account ( www.ripway.com is OK)

Step 4. Open the script, fill in the variables
Done! Just use the script by typing "shoot filenameforimage"

The Script



#!/bin/bash

#VARIABLES - change them as required

FTPSERVER=ftphost.ripway.com # No need to change if you are going with ripway.
USERNAME=WRITE USERNAME HERE
PASSWORD=WRITE PASS HERE
dir=~/documents/pictures/screenshots # directory for screenshots

###

scrot -d 3 -q 1 "$dir/$1.png" # screenshot taken in png format after a delay of 3 seconds

echo "Upload to ftp?"
read ans

if [[ "$ans" == "y" ]]
then
ncftpput -u $USERNAME -p $PASSWORD $FTPSERVER / $dir/$1.png

## OPTIONAL PART!!
# path of uploaded file - use this to paste ; would depend on youR ftp server;username
#echo http://h1.ripway.com/chesss/$1.png
else

echo not uploaded

fi

exit