How do you change the app focus when taking a screenshot?

Asked by Kyle VandenLangenberg

So this is probably a simple issue, but I can't seem to get around it.

So I want to take a screenshot of something like Firefox, the entire application.

Im doing this as a wait command. So I want to start firefox, and then wait until it opens for the next command.

So I'm doing:

SwitchApp("Firefox.app")
wait(screen shot of full Firefox application)
....

However, when you click Take Screenshot in Sikuli the application focus doesn't change to Firefox. It just hides Sikuli, and if Firefox is the exposed window underneath it appears. But not 'in focus'.

This is a problem because Firefox looks different when its the focused application (the entire menu bar changes color, the red,yellow,green buttons appear, etc.). Because I can't take a screenshot of the focused-Firefox, the wait command isn't actually recognizing the entire application.

I'm running Mac OS 10.7.

Any suggestions?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

use the screenshot hotkey (Mac standard: shift-cmd-2) having IDE open after focusing the FF window.

This hotkey is configurable in the Preferences.

Another option (Preferences) is to increase the capture delay time, so you have enough time to click the app to foreground after the IDE has vanished. But then you have to wait always, which might be boring ;-)

Revision history for this message
Tony Becker (tnybecker) said :
#2

I sometimes have a similar problem on Windows. I use a very pragmatic approach; there is a period of about a second between the time I click the camera icon in Sikuli and the screen being greyed. In that time I click on the application I wish to take a screenshot of to bring it into focus.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

@ Tony
as with comment #1:
Another option (Preferences) is to increase the capture delay time, so you have enough time to click the app to foreground after the IDE has vanished. But then you have to wait always, which might be boring ;-)

So you might make your life a little bit more comfortable by increasing the delay to 2 or 3 seconds ;-)

Can you help with this problem?

Provide an answer of your own, or ask Kyle VandenLangenberg for more information if necessary.

To post a message you must log in.