Specify targetOffset(). to match object
Hi
i am searching for image and if image exists if return match object.
now in this match object i want to click on certain location
click(
where obj is match object
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Sikuli Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- RaiMan
- Solved:
- 2021-02-25
- Last query:
- 2021-02-25
- Last reply:
- 2021-02-17
This question was reopened
- 2021-02-17 by Chetan
Manfred Hampl (m-hampl) said : | #1 |
You can specify the targetOffset when defining the match object.
obj = region.
And
Since a match object is a region, you could work with the location
click(obj.
Chetan (cshamdas) said : | #2 |
i am using s obj.setTargetOf
Chetan (cshamdas) said : | #3 |
when i use SCREEN.
then get below error
obj=
TypeError: 'org.sikuli.
Chetan (cshamdas) said : | #4 |
when i use SCREEN.
then get below error
obj=
TypeError: 'org.sikuli.
|
#5 |
The intended use of targetOffset() is with a Pattern() object:
somePattern = Pattern(
click(somePattern)
Your approach only makes sense, if you want to assign more than one offset to a match, that is found once and reused several times.
- modifying the match:
match = find(someImage)
click(match.
- not modifying the match (see Manfed Hampel above comment#1):
match = find(someImage)
click(match.
or even shorter:
click(match.
(this creates a new Region with top-left offset and same size and it's center is clicked then)
Chetan (cshamdas) said : | #6 |
Thanks for your help
Chetan (cshamdas) said : | #7 |
Thanks RaiMan, that solved my question.