How can I auto-press a button in a graphical program a few seconds after it is started.
I have build a physical photobooth with some friends that is going to be used at a smaller festival where it will provide free fun for all. It basically consists of a box with a computer loaded with xubuntu along with a few scripts and a webcam - and a microcontroller to control a few external things. We are using the program "Cheese" as a the main gui interface to take pictures.
When the computer starts, we autologin into xfce and start a terminal bash script using xubuntus autostart feature. Also the program "Cheese" is started. The problem is that Cheese needs a buttonpress on F11 in order to enter fullscreen mode. I tried to use devilspie to maximize it on start, but "maximized" is not the same as "fullscreen" in this case. Ofcourse We could just alter the Cheese code as it could hardly take much code to, but i would really much rather have the one from the repositories.
In any case...
Does any of you have an idea of how i might autopress the F11 button in this program?
Try using xdotool and a command like this:
xdotool search "Mozilla Firefox" windowactivate --sync key "F11"
...you'll need to change "Mozilla Firefox" to whatever the window title, name or class of the Cheese program is.
YES! That worked..
Thanks so much!!! The later versions that had the fullscreen-on-startup-functionality did not work with my webcam, so have to use the xdotool trick.
Other users in same situation should note that if you do not have the latest version of xdotool you might need to break up your code like this
windowId= `xdotool search --title "Cheese" --onlyvisible
xdotool windowactivate $windowId
xdotool key F11