Practical programming for non programmers

Programming is for everyone!

Under this category small code pieces will be post and explanations. They are intended for people without programming or IT background. They will be simple and will do very specific tasks.
Languages that will be used will be java, python, groovy, perl and others. The code will be well explained, easy for customization and running.

Example groovy / java code.

Java code doing N times mouse click


//import of the required libraries
import java.awt.Robot;
import java.awt.event.KeyEvent;
//create new robot object used to perform the mouse click
Robot r = new Robot();
//do a loop 5 times and press left mouse button and then release it after 0,5 sec
for (number in 1.. 5) {
   r.mousePress(KeyEvent.BUTTON1_MASK);
   r.delay(500);
   r.mouseRelease(KeyEvent.BUTTON1_MASK);
}