Outils pour utilisateurs

Outils du site


issue149:tutoriel1

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
issue149:tutoriel1 [2019/10/01 08:53] – créée d52frissue149:tutoriel1 [2019/10/16 10:19] (Version actuelle) andre_domenech
Ligne 1: Ligne 1:
- +**We will be using xdotool: https://www.semicomplete.com/projects/xdotool/
- +
-We will be using xdotool: https://www.semicomplete.com/projects/xdotool/ +
  
 Here is a story for you to read; it involves a guy who automated everything that took any of his time: https://www.businessinsider.com/programmer-automates-his-job-2015-11?IR=T Here is a story for you to read; it involves a guy who automated everything that took any of his time: https://www.businessinsider.com/programmer-automates-his-job-2015-11?IR=T
Ligne 11: Ligne 8:
 A computer running Ubuntu Linux (I am using Xubuntu). A computer running Ubuntu Linux (I am using Xubuntu).
 Geany. Geany.
-A learning mindset.+A learning mindset.**
  
-Before we begin, I want you to look at the xdotool man page. You can also type: xdotool - -help to see a list of valid commands.+Nous utiliserons xdotool : https://www.semicomplete.com/projects/xdotool/ 
 + 
 +Voici une histoire que vous pouvez lire : dedans, un gars automatise tout, qui lui prenait un moment de son temps : https://www.businessinsider.com/programmer-automates-his-job-2015-11?IR=T 
 + 
 +Malgré ses scripts en Ruby, elle présente un angle intéressant. Bien que je ne vous montre pas comment automatiser l'envoi de messages texte à votre patron quand vous avez la gueule de bois, j'essaierai de vous faire prendre le début du chemin de l'automatisation avec Ubuntu. 
 + 
 +Ce dont nous avons besoin : 
 +Un ordinateur tournant sous Ubuntu Linux (j'utilise Xubuntu). 
 +Geany. 
 +Un esprit ouvert à l'apprentissage. 
 + 
 +**Before we begin, I want you to look at the xdotool man page. You can also type: xdotool - -help to see a list of valid commands.
  
 Let us start by creating an empty file, naming it myscript.sh, and making it executable. Let us start by creating an empty file, naming it myscript.sh, and making it executable.
Ligne 29: Ligne 37:
 sleep 1 sleep 1
  
-xdotool type "I am too lazy to type this over and over again"+xdotool type "I am too lazy to type this over and over again"**
  
-I am using mousepad, as I am on Xubuntu, but you may have another text editor, like leafpad or featherpad. Please feel free to substitute your text editor.+Avant de commencer, vous devez regarder la page man de xdotool, s'il vous plaît. Vous pouvez taper aussi xdotool --help pour voir une liste des commandes valides. 
 + 
 +Commençons par créer un fichier vide, appelons-le myscript.sh et rendons-le exécutable. 
 + 
 +Si c'est la première fois pour vous - 
 + 
 +touch myscript.sh 
 + 
 +chmod +x myscript.sh 
 + 
 +Maintenant, ouvrez le fichier (myscript.sh) avec Geany et insérez ce qui suit : 
 + 
 +mousepad& 
 + 
 +sleep 1 
 + 
 +xdotool type "Je suis trop paresseux pour taper cela en permanence" 
 + 
 +**I am using mousepad, as I am on Xubuntu, but you may have another text editor, like leafpad or featherpad. Please feel free to substitute your text editor.
  
 So let us dissect it.  So let us dissect it. 
Ligne 43: Ligne 69:
 ./myscript.sh ./myscript.sh
  
-The terminal is fast, much faster than GUI programs, if we do not pause to wait after opening mousepad, half of out text will be in the terminal and half inside notepad.+The terminal is fast, much faster than GUI programs, if we do not pause to wait after opening mousepad, half of out text will be in the terminal and half inside notepad.**
  
-Ever wonder how something spookily types notes on a computer in the movies? Now you know! +J'utilise mousepad, car je suis sous Xubuntu, mais vous pourriez avoir un autre éditeur de texte, comme leafpad ou featherpad. N'hésitez pas à utiliser votre éditeur de texte. 
 + 
 +Détaillons son contenu. 
 + 
 +••Nous lançons mousepad. 
 +••Nous faisons une pause d'une seconde - je vous dirai pourquoi *. 
 +••Nous saisissons quelque chose dans mousepad. 
 + 
 +Si vous utilisez Geany, vous avons un terminal dans le bandeau du bas. Sinon, ouvrez un terminal et lancez le script : 
 + 
 +./myscript.sh 
 + 
 +Le terminal est rapide, beaucoup plus que les programmes en affichage graphique ; si vous ne faites pas une pause après avoir ouvert mousepad, la moitié de votre texte sera dans le terminal et le reste dans notepad. 
 + 
 +**Ever wonder how something spookily types notes on a computer in the movies? Now you know! 
  
 How about simulating key-presses?  How about simulating key-presses? 
Ligne 54: Ligne 94:
  
 This will launch the help file right after typing your message. How about we save our mousepad file instead of opening help? If you click on “File” in your text editor window, chances are you will see ‘Save’ and ‘Ctrl+S’ as the shortcut key next to it. The way that you simulate the Enter-key is:  This will launch the help file right after typing your message. How about we save our mousepad file instead of opening help? If you click on “File” in your text editor window, chances are you will see ‘Save’ and ‘Ctrl+S’ as the shortcut key next to it. The way that you simulate the Enter-key is: 
 +
 +xdotool key KP_Enter**
 +
 +Vous vous êtes déjà demandé comment quelque chose d'obscur tape des notes sur un ordinateur dans les films ? Maintenant vous le savez !
 +
 +Comment simuler l'appui sur les touches ?
 +
 +L'appui sur les touches est aussi simple que de taper la touche sur laquelle vous voulez appuyer, ou une combinaison de touches, la première touche suivi du signe « + » et de la seconde touche. Maintenant, ajoutez la ligne suivante à votre code et lancez-le.
 +
 +xdotool key F1
 +
 +Ceci lancera le fichier d'aide tout de suite après avoir tapé votre message. Et si on sauvegardait le fichier mousepad au lieu d'ouvrir l'aide ? Si vous cliquez sur « Fichier » dans la fenêtre de votre éditeur de texte, il y a des chances que vous voyiez « Enregistrer » et « Ctrl+S » qui est son raccourci. La façon de simuler Ctrl+S est :
  
 xdotool key KP_Enter xdotool key KP_Enter
  
-Your homework is to name your text file ‘test.txt’ and save it. +**Your homework is to name your text file ‘test.txt’ and save it. 
  
 You have everything you need to do it. So do it. I will show you how I did it in the next issue and we will continue with our automation journey with more hands-on examples. We will also go into mouse movement and clicking. You have everything you need to do it. So do it. I will show you how I did it in the next issue and we will continue with our automation journey with more hands-on examples. We will also go into mouse movement and clicking.
  
 +Feel free to contact me on Telegram if you have any questions.**
 +
 +Votre travail personnel est de nommer votre fichier texte « test.txt » et de l'enregistrer.
  
 +Vous avez tout le nécessaire pour le faire. Donc, faites-le. Je vous montrerai comment je l'ai fait dans le prochain numéro et nous continuerons notre voyage dans l'automatisation avec d'autres exemples pratiques. Nous verrons aussi les mouvements de la souris et les clics.
  
-Feel free to contact me on Telegram if you have any questions.+N'hésitez pas à me contacter sur Telegram si vous avez des questions.
  
issue149/tutoriel1.1569912824.txt.gz · Dernière modification : 2019/10/01 08:53 de d52fr