Re: [Sikuli-driver] [Question #272088]: onAppear with an array of images?

2015-10-06 Thread Ryan
Question #272088 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/272088

Status: Answered => Solved

Ryan confirmed that the question is solved:
Thanks RaiMan, that solved my question.

-- 
You received this question notification because your team Sikuli Drivers
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


Re: [Sikuli-driver] [Question #272088]: onAppear with an array of images?

2015-10-06 Thread RaiMan
Question #272088 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/272088

Status: Open => Answered

RaiMan proposed the following answer:
Yes, one event for one image (currently ;-)

This is the appropriate solution for version 1.1.0+:

r = Region(Region(2516,495,694,273))
leftSide = [("left1.png"), ("left2.png"), ("left3.png"), ("left4.png"), 
("left5.png"), ("left6.png"), ("left7.png"), ("left8.png"), ("left9.png"), 
("left10.png"), ("left11.png")]
rightSide = [("right1.png"), ("right2.png"), ("right3.png"), ("right4.png"), 
("right5.png"), ("right6.png"), ("right7.png"), ("right8.png"), ("right9.png"), 
("right10.png"), ("right11.png"), ("right12.png")]
neitherSide = [("center1.png"), ("center2.png"), ("center3.png"), 
("center4.png")]

def moveLeft(event):
type(Key.LEFT)
event.repeat(0.2) # continue observation after 0.2 seconds

def moveRight(event):
type(Key.RIGHT)
event.repeat(0.2) # continue observation after 0.2 seconds

# register the events with region r
# one event == one image
for ls in leftSide:
  r.onAppear(ls, moveRight)
for rs in rightSide:
  r.onAppear(rs, moveLeft)
nor rs in neitherSide:
  r.onAppear(ns, moveRight)

# run the observation
r.observe(FOREVER)

-- 
You received this question notification because your team Sikuli Drivers
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


Re: [Sikuli-driver] [Question #272088]: onAppear with an array of images?

2015-10-06 Thread RaiMan
Question #272088 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/272088

RaiMan proposed the following answer:
Uuups, crazy copy and paste ;-)

for ls in leftSide:
  r.onAppear(ls, moveLeft)
for rs in rightSide:
  r.onAppear(rs, moveRight)
for ns in neitherSide:
  r.onAppear(ns, moveRight)

Be aware:
Since currently in one observe processing step, all events are checked in 
sequence, this one step will last about 5 - 10 seconds (about 25 events each 
about 0.3 seconds).

To make it faster, the most recommended approach is to make the region
as small as possible.

Another possibility is to use a different Region object for each of the
image groups left, right and neither, since the observe then could be
run in background and would be delegated to 3 subprocesses.

rLeft = 
for ls in leftSide:
  rLeft.onAppear(ls, moveLeft)
# same for left and neither

# run the observation
rLeft.observeInBackground(FOREVER)
# same for left and neither

# to keep the script alive
wait(FOREVER)

-- 
You received this question notification because your team Sikuli Drivers
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


[Sikuli-driver] [Question #272088]: onAppear with an array of images?

2015-10-05 Thread Ryan
New question #272088 on Sikuli:
https://answers.launchpad.net/sikuli/+question/272088

https://pastebin.com/9fFre1Bm
How do I go about doing something like this? It sounded like a fairly simple 
concept when I started, but it seems like onAppear only works with individual 
images.

-- 
You received this question notification because your team Sikuli Drivers
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