<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog Modulaweb &#187; zenity</title>
	<atom:link href="http://www.modulaweb.fr/blog/tags/zenity/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.modulaweb.fr/blog</link>
	<description>Le blog des technologies modulables orientées web</description>
	<lastBuildDate>Thu, 16 Dec 2010 03:02:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Quelques scripts pour profiter de son scanner sous GNU/Linux</title>
		<link>http://www.modulaweb.fr/blog/2009/05/quelques-scripts-pour-profiter-de-son-scanner-sous-gnulinux/</link>
		<comments>http://www.modulaweb.fr/blog/2009/05/quelques-scripts-pour-profiter-de-son-scanner-sous-gnulinux/#comments</comments>
		<pubDate>Fri, 22 May 2009 18:34:52 +0000</pubDate>
		<dc:creator>Jean-François VIAL</dc:creator>
				<category><![CDATA[Choses utiles]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[infographie]]></category>
		<category><![CDATA[sane]]></category>
		<category><![CDATA[zenity]]></category>

		<guid isPermaLink="false">http://www.modulaweb.fr/blog/?p=321</guid>
		<description><![CDATA[Sous GNU/Linux (et même sous BSD et autres Solaris), les scanners sont très bien gérés grâce au proget SANE. Bien que les interface graphiques pour SANE, comme XSane, soient très abouties, rien de mieux pour une utilisation "courante" de son scanner que les boutons dont il dispose. Le problème c'est qu'autant les scanners sont bien [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-322" src="http://www.modulaweb.fr/blog/wp-content/uploads/2009/05/gnome-dev-scanner.png" alt="" width="128" height="128" />Sous GNU/Linux (et même sous BSD et autres Solaris), les scanners sont très bien gérés grâce au proget SANE. Bien que les interface graphiques pour SANE, comme XSane, soient très abouties, rien de mieux pour une utilisation "courante" de son scanner que les boutons dont il dispose.</p>
<p>Le problème c'est qu'autant les scanners sont bien supportés en tant que tels, autant leurs boutons sont excessivement peu souvent supportés.</p>
<p>Certains, comme moi, seront certainement très frustrés de ne pas pouvoir utiliser les très utiles boutons de leur appareil, et je me suis dit que quelques petits scripts seraient certainement utiles à d'autres.<span id="more-321"></span><strong></strong></p>
<p><strong>Attention :</strong> j'utilise <a href="http://www.gnomefr.org/">Gnome</a>, et les scripts suivants utilisent <a href="http://library.gnome.org/users/zenity/index.html.fr">zenity</a>. Si vous êtes sous <a href="http://fr.kde.org/">KDE</a>, mieux vaut utiliser <a href="http://docs.kde.org/stable/fr/kdewebdev/kommander/kmdr-basics.html">kommander</a> (je vous laisse le soin d'adapter les scripts), mais vous pouvez très bien utiliser zenity… ça sera moins bien intégré, c'est tout.</p>
<p>Un préalable au bon fonctionnement de ces scripts est, bien entendu, qu'un scanner soit déjà connecté à la machine, et que se scanner soit reconnu et configuré… en plus, pour le premier, d'avoir une imprimante connectée, allumée, et configurée.</p>
<p>Comme d'habitude, un petit tour dans le man ne fera de mal à personne.</p>
<h2>Photocopie</h2>
<p><strong>Dépendances :</strong> tiff2ps (paquet libtiff-tools), zenity (ou kommander)<br />
<strong>Ce que fait le script :</strong> scanne vers un fichier TIFF, le convertit en PostScript et imprime le résultat.</p>
<pre class="bash"><span style="color: #808080; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">if</span> `zenity --question --<span style="color: #007800;">text=</span><span style="color: #ff0000;">&quot;Assurez-vous d'avoir aligné le document sur le bord DROIT de la fenêtre puis cliquez sur «Valider»&quot;</span> --<span style="color: #007800;">title=</span><span style="color: #ff0000;">&quot;Photocopier un document&quot;</span>`
<span style="color: #000000; font-weight: bold;">then</span>
	scanimage --format tiff --mode Gray --resolution <span style="color: #000000;">300</span> -l <span style="color: #000000;">0</span> -t <span style="color: #000000;">0</span> -x 210mm -y 297mm -p &gt; tmp.tiff
	tiff2ps -z -<span style="color: #c20cb9; font-weight: bold;">w</span> <span style="color: #000000;">8.27</span> -h <span style="color: #000000;">11.69</span> tmp.tiff | <span style="color: #c20cb9; font-weight: bold;">lpr</span>
	<span style="color: #c20cb9; font-weight: bold;">rm</span> -f tmp.tif
<span style="color: #000000; font-weight: bold;">else</span>
	zenity --info --<span style="color: #007800;">text=</span><span style="color: #ff0000;">&quot;Photocopie annulée&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre>
<h2>Scan2PDF</h2>
<p><strong>Dépendances :</strong> tiff2pdf (paquet libtiff-tools), zenity (ou kommander), evince (kpdf sous kde)<br />
<strong>Ce que fait le scritpt :</strong> scanne vers un fichier TIFF, le convertit en PDF et l'enregistre là où l'a indiqué l'utilisateur. Si l'utilisateur le souhaite, l'affiche à l'écran.</p>
<pre class="bash"><span style="color: #808080; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> `zenity --question --<span style="color: #007800;">text=</span><span style="color: #ff0000;">&quot;Assurez-vous d'avoir aligné le document sur le bord DROIT de la fenêtre puis cliquez sur «Valider»&quot;</span> --<span style="color: #007800;">title=</span><span style="color: #ff0000;">&quot;Scanner un document vers PDF&quot;</span>`
<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">pdf=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>zenity --file-selection --save --confirm-overwrite --<span style="color: #007800;">filename=</span><span style="color: #ff0000;">&quot;$HOME/Desktop/scan.pdf&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> -n <span style="color: #007800;">$pdf</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
    <span style="color: #000000; font-weight: bold;">then</span>
        scanimage --format tiff --mode Gray --resolution <span style="color: #000000;">300</span> -l <span style="color: #000000;">0</span> -t <span style="color: #000000;">0</span> -x 210mm -y 297mm -p &gt; tmp.tiff
        tiff2pdf -o <span style="color: #007800;">$pdf</span> -z -p A4 -r d -c scan2pdf -a $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">whoami</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ./tmp.tiff
        <span style="color: #c20cb9; font-weight: bold;">rm</span> -f tmp.tiff
        <span style="color: #000000; font-weight: bold;">if</span> `zenity --question --<span style="color: #007800;">text=</span><span style="color: #ff0000;">&quot;Le document va s'ouvrir&quot;</span> --<span style="color: #007800;">title=</span><span style="color: #ff0000;">&quot;Scan terminé&quot;</span>`
        <span style="color: #000000; font-weight: bold;">then</span>
            evince <span style="color: #007800;">$pdf</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        zenity --info --<span style="color: #007800;">text=</span><span style="color: #ff0000;">&quot;Copie annulée&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">else</span>
    zenity --info --<span style="color: #007800;">text=</span><span style="color: #ff0000;">&quot;Copie annulée&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre>
<h2>Scan2Gimp</h2>
<p><strong>Dépendances :</strong> zenity (ou kommander),tempfile gimp<br />
<strong>Ce que fait le scritpt :</strong> scanne vers un fichier TIFF sauvegardé sur le bureau avec un nom unique et l'ouvre avec <a href="http://www.framasoft.net/article1054.html">Gimp</a>.</p>
<pre class="bash"><span style="color: #808080; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> `zenity --question --<span style="color: #007800;">text=</span><span style="color: #ff0000;">&quot;Assurez-vous d'avoir aligné le document sur le bord DROIT de la fenêtre puis cliquez sur «Valider»&quot;</span> --<span style="color: #007800;">title=</span><span style="color: #ff0000;">&quot;Scan vers Gimp&quot;</span>`
<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">tmp=</span><span style="color: #ff0000;">&quot;$(tempfile -d &quot;</span><span style="color: #007800;">$HOMEDesktop</span><span style="color: #ff0000;">&quot; -p &quot;</span>scan-<span style="color: #ff0000;">&quot; -s &quot;</span>.tiff<span style="color: #ff0000;">&quot;)&quot;</span>
    scanimage --format tiff --mode Gray --resolution <span style="color: #000000;">300</span> -l <span style="color: #000000;">0</span> -t <span style="color: #000000;">0</span> -x 210mm -y 297mm -p &gt; <span style="color: #007800;">$tmp</span>
    <span style="color: #c20cb9; font-weight: bold;">gimp</span> <span style="color: #007800;">$tmp</span>
<span style="color: #000000; font-weight: bold;">else</span>
    zenity --info --<span style="color: #007800;">text=</span><span style="color: #ff0000;">&quot;Scan annulé&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre>
<h4 class='related-posts-header'>Articles apparentés</h4><ul class="related-posts-list"><li class="related-post"><a href="http://www.modulaweb.fr/blog/2009/08/creer-un-fichier-pid-pour-funambol-sous-gnu-linux/">Créer un fichier PID pour Funambol sous GNU/Linux</a> </li><li class="related-post"><a href="http://www.modulaweb.fr/blog/2010/11/optimiser-apache/">Optimiser Apache – Partie 1</a> </li><li class="related-post"><a href="http://www.modulaweb.fr/blog/2010/07/ressources-graphiques/">Ressources graphiques</a> </li><li class="related-post"><a href="http://www.modulaweb.fr/blog/2009/05/configurer-vsftpd-pour-mettre-a-jour-automatiquement-wordpress/">Configurer vsftpd pour mettre à jour automatiquement Wordpress</a> </li><li class="related-post"><a href="http://www.modulaweb.fr/blog/2009/02/inclure-ses-machines-virtuelles-a-son-reseau-avec-virtualbox/">Inclure ses machines virtuelles à son réseau avec VirtualBox</a> </li><li class="related-post"><a href="http://www.modulaweb.fr/blog/2009/02/un-nuancier-pantone%c2%ae-en-ligne/">Un nuancier Pantone® en ligne</a> </li><li class="related-post"><a href="http://www.modulaweb.fr/blog/2009/02/installation-de-funambol-couple-a-zimbra-sur-un-serveur-gnu-linux/">Installation de Funambol couplé à Zimbra sur un serveur GNU/Linux</a> </li><li class="related-post"><a href="http://www.modulaweb.fr/blog/2009/02/pour-des-sessions-ssh-qui-durent/">Pour des sessions SSH qui durent</a> </li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.modulaweb.fr/blog/2009/05/quelques-scripts-pour-profiter-de-son-scanner-sous-gnulinux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

