OESF Portables Forum

Everything Else => Zaurus Distro Support and Discussion => Distros, Development, and Model Specific Forums => Archived Forums => Angstrom & OpenZaurus => Topic started by: mimeca on August 13, 2005, 02:36:54 pm

Title: Local Screenshot Script
Post by: mimeca on August 13, 2005, 02:36:54 pm
Hi

I have develop a script with similar similar to scap. It takes a screenshot (with fbgrab) and stores it on local folder. Script has .desktop file asociated and it appears on GPE menu near Online screenshot. I haven't build an ipkg package.

Options:
- Ask user his / her native language and create two different folders:
 ~/Images/Screenshots/    with english language
 ~/Imagenes/Capturas/     with spanish language
- That questions only is asked one time, next times it takes the correct folder
- After push on "local screenshot" item, it takes a screenshot after 5 seconds and stores it on selected folder. Name is composed with date and hour.

Do you want some aditional feature? Do you have some suggestion?

I will upload script after check some options next week.
Title: Local Screenshot Script
Post by: mimeca on August 18, 2005, 03:38:50 pm
This is the script. Please, mail ma any sugestion

 There's a desktop access and, this program, appear on menu. You
need install fbgrab. I paste code (I have some problems uploading
somewhere). Script save image on local folder ~/Images/Screenshots for
english

Script: scap-local.sh | directory: /usr/bin
===================================

#!/bin/sh

# ==============================
# Description: Take a screenshot and save it
#       on local file with a 5 seconds delay.
#       It ask user his/her natural language
# Author: mimecar (Miguel Menendez)
# Dependences: fbgrab (ipkg install fbgrab)
# Version: 1.0
# Bugs: Image is rotate
# Mail: mimecares@yahoo.es
# ==============================

# Check if destination directory exist
# If it doesn't exist, ask user language
if      test -d ~/Images/Screenshots/ ||
        test -d ~/Imagenes/Capturas/
then
        echo "Direcory  Ok"
else
        # English and Spanish use different folder      
        # name. We ask user his/her native
        # language. This code only runs one time
        # (if image folder doesn't exist)

        echo "Screenshots folder name is related with"
        echo "your native language. What's your language "
        echo "- English         1"
        echo "- Spanish 2"
        read -p "Select your language: " INPUT

        # There isn't error detection
        case $INPUT in
        1) echo "Ok, using English as language"
                mkdir ~/Images/
                mkdir ~/Images/Screenshots/
                echo
                echo "I will store images on ~/Images/Screenshots"
                return 0
                ;;
        2) echo "Ok, usando Castellano como idioma"
                mkdir ~/Imagenes/
                mkdir ~/Imagenes/Capturas/
                echo
                echo "Guardare las imagenes en ~/Imagenes/Capturas"
                return 0
                ;;
        *)  echo "You must select a valid number"
                return 0
                ;;
        esac

fi


# Define working folder
if      test -d ~/Images/Screenshots/
then
        FOLDER=~/Images/Screenshots/
fi

if      test -d ~/Imagenes/Capturas/
then
        FOLDER=~/Imagenes/Capturas/
fi


# We compose file name with date and hour. Free
# spaces  within date will crash fbgrab. This can
# be solved with the help of sed
NAME=$(date +%Y%m%d@%k%M%S)
NAME=$(echo $NAME | sed s/\ /0/g).png

echo "Screenshot stars in 5 seconds"
fbgrab -s 3 -d /dev/fb0 $FOLDER$NAME


=================================================================

scap-local.desktop | Folder: /usr/share/applications

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Local Screenshot
Comment=Capture screenshot and save it locally
Exec=/home/mimecar/Scripts/scap-local.sh
Terminal=false
Type=Application
Icon=scap.png
Categories=Action
StartupNotify=False
Name[es_ES]=Local Screenshot.desktop


================================================================
Title: Local Screenshot Script
Post by: cesarcardoso on October 16, 2005, 03:30:15 pm
Great work, mimeca! Works fine.

Only remembering that fbgrab isn't installed by default on OZ, you should install it prior to running the script
Title: Local Screenshot Script
Post by: mimeca on October 17, 2005, 01:44:07 am
That's true. Users should install fbgrab before    If you have some sugestion with the script, write an reply