Follow the keyboard selection in Ubuntu preferably by Python
Question: I am doing automation of my application. To do this at one point I need to
move my mouse to selected item. I shall select the item with my keyboard and
mouse will move accordingly to that point. Is there any code for doing this in
Ubuntu 12.04 and 12.10. I am using Python for automation.


Answer: Assuming you:

  * Know the coordinates of the "item" you've selected in your application
  * Are using Ubuntu

You can do this inside your python script:

    
    
    from subprocess import call
    call(["xdotool", "mousemove", "300", "500"])
    

You might have to install xdotool if you don't have it installed:

    
    
    sudo apt-get install xdotool
    

You may want to `man xdotool` to get more information on it - it's pretty
awesome for automating keyboard/mouse events!

