staging.inyokaproject.org

"Erweiterung" zu scrot

Status: Ungelöst | Ubuntu-Version: Nicht spezifiziert
Antworten |

suncity

Avatar von suncity

Anmeldungsdatum:
24. Februar 2007

Beiträge: 180

Hallo,

ich habe ein kleines Script geschrieben, das scrot (ein Screenshot Programm) in gewisser Weise erweitert. Die Funktion ist, dass alle x Sekunden y Screenshots geschossen werden und dafür wird dann scrot benötigt.

Was sagt ihr dazu?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash

#@Disclaimer: Extension by Dennis Seid
#@Website: www.jumartistry.co.nr
#@License: CreativeCommons BY-SA 3.0 Germany
#@Disclosure: Needs Scrot for running!
#@ToDo:
# - default output for invalid parameter
# - improve parameter handling
# - improve performance by adjusting the position of the if loops
# - implmentation of $5 for execute a program
# - define 0 as not passed or given, example: xshot foo.jpg 10 2 0 my_game.bin < means that [DIRECTORY] is not or doesn't want to be given

#set variables
NAME=xshot
#$1 Name of the screenshot file
#$2 How often should the screenshots are made
#$3 Delay between the screenshots in seconds
#$4 Where to save
#*NOT IMPLEMENTED* $5 The application name from which the screenshots should be taken


#check if the required first 3 parameters are passed
if [ $# -lt 3 ]; then
	echo "You have to enter at least 3 parameters: [FILENAME_WITH_EXTENSION] [NUMBER_OF_THE_SCREENSHOTS] [DELAY]"
fi

#*NOT IMPLEMENTED* start the program if the [APPLICATION NAME] parameter is passed
#if [ "$#" -gt 4 ]; then
#	$5
#fi

#check if the program's name is the only input
if [ "$#" == 0 ]; then
	echo $NAME Help: parameters >> $NAME [FILENAME_WITH_EXTENSION] [NUMBER_OF_THE_SCREENSHOTS] [DELAY] [DIRECTORY]
fi

#if the number of the parameters is greater than 3 it means that [DIRECTORY] is passed, therefore change directory to $4
if [ "$#" -gt 3 ]; then

	cd "$4"

	#if the directory already exists, switch to the directory, if not, create it
	if [ -d "$4" ]; then		
		echo "Directory already exists: Switch to directory..."
		cd "$4"
		echo "...[DONE SUCCESSFUL]"
	else
		echo "Directory does not exist: Create directory..."
		mkdir "$4"
		echo "...[DONE SUCCESSFUL]"
	fi
fi

#make every $3 seconds one screenshot for $2 times
if [ "$#" -gt 3 ]; then
	i=1
	for i in `seq 1 "$2"`
	do
	sleep "$3";
	scrot "$4"/"$i"-"$1"
	done
else
	i=1
	for i in `seq 1 "$2"`
	do
	sleep "$3";
	scrot "$i"-"$1"
	done
fi

cheers, suncity

DRice

Avatar von DRice

Anmeldungsdatum:
27. Februar 2006

Beiträge: 627

schau doch mal hier: http://forum.ubuntuusers.de/topic/gtk2-frontend-fuer-scrot/

vielleicht kann man das ja irgendwie verbinden? 😉

Antworten |