Speed Up the "replay" rate

Asked by Lordpro

Hello,

I am trying to speed up the process of clicking by script.
 I use 10 lines of code for some testing and time between clicks are too slow - i am not using slow motion mode.

Any ideas how to shorten the time between clicks?

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:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

The time for the mouse move to the click position in the standard is set to 500 msec.

Settings.MoveMouseDelay = 0

will remove this delay.

Revision history for this message
Lordpro (kostros-filip) said :
#2

Okay, this helped a lot, but still when i have 3 if cycles how can i speed them up? its just clikin the buttons, i provided my source code, any idea how to speed this code up?

setWaitScanRate(1)
Settings.MoveMouseDelay = 0
n=0
while(n<1):
    n=n+1
    if(has(Pattern("1643014040911.png").targetOffset(-49,-1),3)):
        click(Pattern("1643014040911.png").targetOffset(-49,-1))
    if(has("1643014901291.png",3)):
        click("1643014901291.png")
    if(has(Pattern("1643016386995.png").similar(0.90),3)):
        click(Pattern("1643016386995.png").similar(0.90).targetOffset(174,0))
        click("1643013175497.png")
        click("1643013921634.png")
        click("1643013965598.png")
    if(has(Pattern("1643016940607.png").targetOffset(67,-1),3)):
        click(Pattern("1643013257650.png").exact().targetOffset(187,3))
        click("1643013175497.png")
        click("1643013921634.png")
        click("1643013965598.png")

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

sorry, mind the indents - seems to get lost when editing an answer
--------------------------------------------

Since the search time increases with the size of the region, it is normally not a good idea, to search on the whole screen, if speed matters. Restrict to a Region as small as possible.

setWaitScanRate(1):
this means, that only once per second an image is looked for until the wait time is reached (3 seconds in your case). This makes the image search slower, since in the standard the scan rate is 3 (3 searches per second).
Usually the number of scans per second when searching on the whole screen cannot be raised dramatically, since one search on a whole screen takes up to some hundred msecs.
Only with smaller regions a higher scan rate might help.

Since the standard waitime is 3 seconds
    if(has(Pattern("1643014040911.png").targetOffset(-49,-1),3)):
        click(Pattern("1643014040911.png").targetOffset(-49,-1))

is the same as:
    click(Pattern("1643014040911.png").targetOffset(-49,-1))

If not found within 3 secs: FindFailed crash

Since it is in a loop:
try:
    click(Pattern("1643014040911.png").targetOffset(-49,-1))
    click("1643014901291.png")
except:
    pass # or do something

same for:
    if(has(Pattern("1643014040911.png").targetOffset(-49,-1),3)):
        click(Pattern("1643014040911.png").targetOffset(-49,-1))

better:
    if exists(Pattern("1643014040911.png").targetOffset(-49,-1)):
        click() # clicks last match in the region
        click("1643013175497.png")
        click("1643013921634.png")
        click("1643013965598.png")

Revision history for this message
Lordpro (kostros-filip) said :
#4

Thanks RaiMan, that solved my question.

Revision history for this message
Lordpro (kostros-filip) said :
#5

:) thank you, this helped a lot as well :)