r.hover() doesn't work

Asked by groszexxx on 2019-09-11

Hello.

I am beginer and i have problem with r.hover().

Here i am pasting code when all works fine:

r = selectRegion()
wait(2)
r.hover()
mouseDown(Button.LEFT)
wait(0.1)
mouseUp(Button.LEFT)
print("done")

Here is the code which include same code what is above:

Settings.MoveMouseDelay = 0
regionWyzwalaniaPasekRyba=Region(724,535,27,28)
regionSkanowaniaPodczasLowienia=Region(544,511,192,23)
regionZagrozenia=Region(536,505,100,34)
regionZagrozenia2=Region(660,504,81,36)
regionVanish=Region(533,538,22,19)
i=1
while True:
 if regionWyzwalaniaPasekRyba.exists(Pattern("1568199660564.png").similar(0.83),0):
  if regionZagrozenia.exists(Pattern("1568199838329.png").similar(0.80),0):
   mouseDown(Button.LEFT)
  if regionZagrozenia2.exists(Pattern("1568199838329.png").similar(0.80),0):
   mouseUp(Button.LEFT)
  if not regionWyzwalaniaPasekRyba.exists(Pattern("1568199660564.png").similar(0.93),0):
   for i in range(1):
    r = selectRegion()
    print("step 1")
    wait(6)
    print("step 2")
    r.hover()
    mouseDown(Button.LEFT)
    wait(0.1)
    print("step 3")
    mouseUp(Button.LEFT)
    print("done")

Same code and different effects. I recived only two messages:
step 1
step 2

2 times on 60x times this code works. Very often i got messages from all steps, but ofc without hover and any reaction from mouse. For me it is big mistery. Do You have any advice? I wasted many hours to undestarnd it. Without effect.
I tried change (even delete) Settings.MoveMouseDelay = 0 . If I deleted r.hover() - click doesn't works too, but print printed all steps normaly.

One more important thing: if i manualy clicked once before command: mouseDown(Button.Left) - then it works normaly.

Edit:

It is funy when i spend many hours on resolve this and after publication this i got revelation. Loop for in 99% started with mouseDown(Button.LEFT).
So i added mouseUp(Button.LEFT) after line 25 for i in range(1): mouseUp(Button.LEFT) and all works good.
Thank You.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
groszexxx
Solved:
2019-09-11
Last query:
2019-09-11
Last reply:
groszexxx (groszexxx) said : #1

It is funy when i spend many hours on resolve this and after publication this i got revelation. Loop for in 99% started with mouseDown(Button.LEFT).
So i added mouseUp(Button.LEFT) after line 25 for i in range(1): mouseUp(Button.LEFT) and all works good.
Thank You.