Bonjour,
Alors voilà, après avoir modifié LyX, voici comment j'ai pu m'en servir
pour obtenir exactement le résultat que je voulais.
J'ai dû écrire deux bash finalement pour éviter que les tubes s'emmêlent.
Le premier effectue la mise à jour des statistiques dans un fichier dédié :
lyxupdatestats :
cat ~/.lyx/lyxpipe.out > ~/.lyx/lyxpipe2$1.out &
echo "LYXCMD:bro:server-get-statistics:$1" >~/.lyx/lyxpipe.in
Un autre qui récupère les statistiques à afficher :
lyxgetstats :
sleep 0.02
case "$1" in
words)
arg=1;
;;
chars)
arg=2;
;;
chars-space)
arg=3;
;;
esac
cut -d":" -f4 ~/.lyx/lyxpipe2.out | cut -d" " -f$arg
Et quatre commandes Latex pour utiliser tout ça :
\newcommand\updatestats{
\immediate\write18{/home/steph/bin/lyxupupdatestats}
}
\newcommand\statwords{
\immediate\write18{/home/steph/bin/lyxgetstats
words>/home/steph/.lyx/statw.txt}
\input{/home/steph/.lyx/statw.txt}
}
\newcommand\statchars{
\immediate\write18{/home/steph/bin/lyxgetstats
chars>/home/steph/.lyx/statc.txt}
\input{/home/steph/.lyx/statc.txt}
}
\newcommand\statcharspace{
\immediate\write18{/home/steph/bin/lyxgetstats
chars-space>/home/steph/.lyx/statcs.txt}
\input{/home/steph/.lyx/statcs.txt}
}
Maintenant, si vous voulez utiliser ces commandes, il faudra
personnaliser les chemins.
Merci à tous pour votre aide, et en particulier Jean-Marc.
Cordialement,
Stéphane Mourey
--
Blog: Impossible Exil <http://impossible-exil.info>