Xfce Forum

Sub domains
 

You are not logged in.

#1 2012-02-24 10:54:15

bovisfeldt
Member
Registered: 2012-02-24
Posts: 2

[Solved] Autopress a key.

Hi guys.

Short version:
How can I auto-press a button in a graphical program a few seconds after it is started.

Full version:
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?

Offline

#2 2012-02-24 14:47:48

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Autopress a key.

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.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2012-02-29 12:46:18

bovisfeldt
Member
Registered: 2012-02-24
Posts: 2

Re: [Solved] Autopress a key.

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

Offline

Board footer

Powered by FluxBB