Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an application which is built using GTK+. The application has a very simple interface. When started, the same window always opens, with a few input controls.

We want to write a script to fill in text in a couple fields, check a check box, then click a button. Pretty simple, and would be easy to do if a command-line version of the app were available (but it isn't).

What's the best way to approach interacting with an X application programmatically?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Give xdotool a look. It's extremely powerful and should be able to do whatever you need.

http://www.semicomplete.com/projects/xdotool/xdotool.xhtml

share|improve this answer
    
i think the use of xdotool should only be considered in real emergency cases! Scripting something serious with xdotool is more a pain than a pleasure. Before you try xdotool ask the developer if the application has a dbus interface. That would make your plan much simpler. –  user1146332 Jul 26 '13 at 14:20

xte, part of xautomation is another tool that you can use to generates fake X11 input using the XTest extension.

From the homepage:

Control X from the command line for scripts, and do "visual scraping" to find things on the screen. The control interface allows mouse movement, clicking, button up/down, key up/down, etc, and uses the XTest extension so you don't have the annoying problems that xse has when apps ignore sent events. The visgrep program find images inside of images and reports the coordinates, allowing progams to find buttons, etc, on the screen to click on.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.