returning from included sikulix script changes screen(0)

Asked by matteoa

hello,
I'm running a sikulix script (below) that is calling another sikulix script, and it does what is is supposed to do (searching for images, clicking, typing), but when returning it seems to change the place where the mother scripts finds images.

What is happening is a problem later in the mother script in a part that prior than the introduction of this call (before it was a piece of the mother script) was working:
I look for an image, then I move and resize the region obtained, then I use this region as a ROI for following searches (the idea was to speedup a search that was rather lenghty)

With the included script the image is found, but the position in which it has been found is about 200pixels right and 50 pixel down of the actual position of the image, so it doesn't found what it was supposed to find.
I found that by highlighting the regions, see below.
Since the position of the whole app that contains the image can change I'd like not to add absolute coodinates, but what I do usually is to find a fixed piece of the app and then using coodinates relative to this piece.

The question is: where is the problem in the included script?

This is the part of the Mother script that calls the included one:
import includedScript
...
listPar=includedScript.CalledFunct()
numWheelClick= listPar[0]
...

This is the part of the mother script that fails:
rReg=find("1548174728109.png")
rReg.highlight(2)
rReg.y=rReg.y+3*rReg.h
rReg.w=280
rReg.h= 500
rReg.highlight(2)

The called script has a single function:
def CalledFunct (regToActOnReg= Screen(0)):
    regToActOnReg.mouseMove("1539092727144.png")
    regToActOnReg.click("1538572839311.png")
    regToActOnReg.wait("1547825730701.png", 15)
    regToActOnReg.type(Pattern("1547825730701.png")),"vf311111111111111" + Key.ENTER)
    retList=[]
    retList.append(12)
    retList.append("1539608590023.png")
    return(retList)

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
matteoa
Solved:
Last query:
Last reply:
Revision history for this message
matteoa (matteoa) said :
#1

Hello,
this problem is not real: I solved the problem by noticing that there was another occurrence of the searched image in another independent position that was not human visible(quickly disappearing), but it was for the powerful eyes of Sikulix...