Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Screenshot script< Next Oldest | Next Newest >
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: Dec. 03 2007,04:33 QUOTE

Works with imagemagick.uci.  Takes arguments for choosing a window <win>, area <area>, or screen <scr>. Creates and stores to $HOME/screenshots/

#!/bin/bash

# Just run it with the argument "win" (for a screenshot of a certain window),
# "scr" (for a screenshot of the entire screen) or "area" (for a screenshot of
# the selected area).

# load imagemagick if not loaded
[ -d /opt/imagemagick ] || mydsl-load /mnt/hda3/imagemagick.uci

DIR="${HOME}/screenshots" DATE="$(date +%Y%m%d@%H%M%S)"
NAME="${DIR}/screenshot-${DATE}.png" LOG="${DIR}/screenshots.log"
IMGK="/opt/imagemagick/bin"

# Check if the dir to store the screenshots exists, else create it:
if [ ! -d "${DIR}" ]; then mkdir "${DIR}"; fi

# Screenshot a selected window
if [ "$1" = "win" ]; then $IMGK/import "${NAME}"; fi

# Screenshot the entire screen
if [ "$1" = "scr" ]; then $IMGK/import -window root "${NAME}"; fi

# Screenshot a selected area
if [ "$1" = "area" ]; then $IMGK/import "${NAME}"; fi

if [[ $# = 0 ]]; then
 # Display a warning if no area defined
 echo "No screenshot area has been specified. Screenshot not taken." echo
"${DATE}: No screenshot area has been defined. Screenshot not taken." >>
"${LOG}" else
 # Save the screenshot in the directory and edit the log
 echo "${NAME}" >> "${LOG}" fi
Back to top
Profile PM 
0 replies since Dec. 03 2007,04:33 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Screenshot script

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code