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: 11,542

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

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 520.4 KiB (Peak: 521.24 KiB) ]