Nonostante tutto ho fatto qualche piccola cosa stasera. Il più l'avevo fatto ieri sera, e in questa ho messo il punto finale.
Vorrei ricordare l'indirizzo del vecchio script in Bash.
Ecco il mio primo script in python:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# AUTHOR: Maurizio di NuvoleSparse
#
# License: GNU General Public version 2 or any later version.
# This program comes with ABSOLUTELY NO WARRANTY; for details
# see the COPYING file or visit "http://www.gnu.org/licenses/gpl.html".
# This is free software, and you are welcome to redistribute it under
# certain conditions. See the GPL license for details.
#
# Dependence:
# ImageMagick
# python
# zenity
#
import os
from time import strftime
from os.path import isdir, isfile, getsize
time = strftime("%Y_%m_%d")
filename = "Shot_"+time+".jpg"
basepath = os.getcwd()
if isdir(basepath+"/Scrivania"):
basedir = basepath+"/Scrivania"
elif isdir(basepath+"/Desktop"):
basedir = basepath+"/Desktop"
else:
basedir = basepath
num = 1
while isfile(basedir+"/"+filename):
num = num + 1
filename = "Shot_"+time+"_"+str(num)+".jpg"
os.system("import -silent -window root -pause 5 -snaps 1 '"\
+basedir+"/"+filename+"' 2>>/tmp/gsnapshot.log")
if getsize("/tmp/gsnapshot.log") != 0:
os.system("cat /tmp/gsnapshot.log | zenity \
--title='Errore - gsnapshot' --text-info")
os.remove("/tmp/gsnapshot.log")
Buona notte! ![]()
Ultimo aggiornamento 06 Aprile 2009