"Matching Preview" of the "Pattern Settings"

Asked by eduardobedoya

I have notice that there are a two screens picture in the "Matching Preview" of the "Pattern Settings"
What if I would like to set all my scripts to always operate only in the main monitor,
Is there a way to show only the main screen picture in the "Pattern Settings"?
What happens if Im creating my scripts in a system with two screens?, but I need to execute them in another system with just one screen? or another screen resolution?
How to perform the findAll inside a small area of the main screen only?
please do you have any links to read?
Thanks Advanced.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:

This question was reopened

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

--- Is there a way to show only the main screen picture in the "Pattern Settings"?
not in version 1.1.0. will be a feature in version 2.
In multi monitor you always see all monitors and cannot select a specific on.

--- What if I would like to set all my scripts to always operate only in the main monitor.
If you say nothing else, SikuliX always only uses the main monitor.
See the multi monitor section in the docs.

--- What happens if Im creating my scripts in a system with two screens?, but I need to execute them in another system with just one screen?
More than one monitor: SikuliX uses main monitor, if nothing else is said
Only one monitor: SikuliX uses this on ;-)

--- How to perform the findAll inside a small area of the main screen only?
define a Region within the main monitor with the various possibilities/features and say:
matches = list(reg.findAll(image))

Revision history for this message
eduardobedoya (gonnabdh) said :
#3

Thanks RaiMan,
I just have a doubt,
if Sikuli by default only search in the main monitor in multimonitor system
why it keeps a screencapture of all monitors in the "Matching Preview" of the "Pattern Settings"???

is that because Sikuli search on the secondary monitor if you specify it?
Thanks advanced.

Revision history for this message
eduardobedoya (gonnabdh) said :
#4

If my script beginn with
App.focus("Chrome")
and then I set a region,
it look in that region only inside chrome right?

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

@ comment 3
The MatchingPreview looks on all monitors (and it is so currently because of the hardcoded implementation), but find() looks only in the given Region or the main monitor if nothing else is said.

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

@ comment 4
--- it look in that region only inside chrome right?
that depends on how you set the region.

Revision history for this message
eduardobedoya (gonnabdh) said :
#7

If my script beginn with App.focus("IrfanView") and then I set a region,
It doesn't matter wich line comes first in the script right? (the App.focus("IrfanView") or the reg = Region())
It worked fine, I doubled the speed
currently Im setting my region this way
reg = Region(x, y, w, h)
and then in every match
matches = list(reg.findAll(image))
But I really would like to search only inside "IrfanView" app
I have notice that, if "IrfanView" is minimized the script runs whitout call it back, I would like to avoid that even when I use App.focus("IrfanView") at the beginning
How should I write the script in order to it to make sure "IrfanView" windows is in focus, is not minized, before set the region

Thanks Advanced.

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

--- But I really would like to search only inside "IrfanView" app
already looked at:
http://sikulix-2014.readthedocs.org/en/latest/appclass.html#the-application-class-app

where you can find how to get the region of an application window?

---How should I write the script in order to it to make sure "IrfanView" windows is in focus, is not minized, before set the region
Currently SikuliX has no feature, to decide wether an app window is visible or not (e.g. minimised).
You have to decide by looking for something fixed in the window's region, that should be there.
If it is not found, you might try to unhide it by automating the context menu of the task bar icon or double click this icon.

Revision history for this message
eduardobedoya (gonnabdh) said :
#9

Thanks RaiMan, that solved my question.

Revision history for this message
eduardobedoya (gonnabdh) said :
#11

Hi RaiMan
Currently I am reading this Sikuli doc (its very extensive)
http://sikulix-2014.readthedocs.org/en/latest/region.html#Region
but I still can't uderstand what you meant by this...
EB--- If my script beginn with
App.focus("Chrome")
and then I set a region,
it look in that region only inside chrome right?
RM--- that depends on how you set the region.

Could you please provide some example or operator name, so I can search for it in the docs?
Thanks Advanced.

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

no pointer for that, you simply have to understand this basic principle of SikuliX:

a Region simply is a coordinate of a top left corner of a rectangular area with a width and a height.
It does not have any content.
A region can be used in various ways:
- restrict the area to search for an image on the screen
- get the current pixel content of that region (capture)
- define other regions with various features based on this region

... and a region can be defined in various ways
- by specifying absolute values for (x,y) and w and h
- by using Region features to define a new region based on the given region (relative e.g. based on a match, spatial operators, ...)
- as a result of other non-Region features (e.g. App.window(), App.focusedWindow()) or find operations (a match is a Region with some added information, but still a coordinate + width + height)

conclusion:
Wether your SikuliX workflow "sees" some application content (Chrome window in your case) depends on, wether this content is currently (at the moment of processing a SikuliX feature) displayed on the screen inside this region area.

I hope you now understand my comment:
... that depends on how you set the region.

Revision history for this message
eduardobedoya (gonnabdh) said :
#13

Thanks RaiMan, that solved my question.