Question #262328 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/262328

    Status: Open => Answered

RaiMan proposed the following answer:
Still with Sikuli, typing and clicking cannot be checked, wether it is
really done.

The only chance is to check the screen, wether it has changed as
expected after a series of Robot actions (type and click).

So in your case it is not obvious, what really happens, besides the 2
places where you look for images (which should crash the script with
FindFailed if the images are not there at that time):

click(u)

find(x) # this is redundant, click(x) is enough
click(x)

If you think an image to be clicked might not come up within the standard 3 
seconds:
click(wait(image, n)) # where n is the number of seconds to wait max

So looking at your flow:
we have these blocks:

# block 1
    type (Key.RIGHT)
    wait(.5)
    type (Key.RIGHT)
    wait(.5)
    type (Key.RIGHT)
    wait(.5)
    type (Key.RIGHT)
    wait(.5)
    type (Key.RIGHT)
    wait(.5)
    type (Key.RIGHT)
    wait(.5)
    type (Key.F4)
    wait(.5)

# block 2
    click (u)

# block 3
    keyDown(Key.CMD)
    keyDown(Key.SHIFT)
    type ("g")
    keyUp(Key.SHIFT)
    keyUp(Key.CMD)
    type ("/Beast Phoenix 01/03-Melodics/01-Albino/Ear Candy") #Changes from 
a() to b() to c() this is my folder location
    wait(.5)
    type (Key.ENTER)
    wait(.5)
    type (“Changeable text")
    wait(.5)
    type (Key.ENTER)
    wait(.5)

# block 4
    find (x) #Defined image reference
    click (x)

# block 5
    wait(.5)
    type (Key.F4)
    wait(.5)

blocks 1, 3 and 5
simply run through, without any feedback, wether they really did their job
This sometimes looks like "runs, but does nothing" if the GUI is not in the 
state to accept the Robot actions (which should usually do some beeps at least 
for the type's going to nowhere)

blocks 2 and 4 
contain a screen search for images u and x and hence should fail, if the images 
are not there.

I cannot see any place in the script, where it should hang for more than 3 
seconds (the find/click), supposing you did not raise the standard waiting time 
somehow.
Spikes in cpu usage by SikuliX are caused by the search functions 
(find/wait/click(image)), which is pure number crunching).

To make such scripts robust and reliable, one has to insert some visual
checks, to assure, that the GUI has reacted as expected after some Robot
actions.

example:
# block 1
…
# supposing the trailing F4 leads to some changes in the GUI:
if not exists(some_check_image, maxTime):
    print("F$ did not work")
    exit() # at this place one might implement corrective actions, but usually 
it does not make sense to continue

So with SikuliX version 1.1.0+ there is no need to reinstall Java or
SikuliX for these kind of symptoms, besides, that one should always use
the latest Java version (for now 7 is ok, 8 need not be) and watch out
for change information about SikuliX versions or known bugs.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to