← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #680146]: How do I get multiple arguments into a class object that I can use in dictionary functions

 

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

    Status: Answered => Solved

Melvin Raymond confirmed that the question is solved:
I figured it wouldn't be that easy to use the Dictionary way, and what
you have shown here is pretty much what I ended up doing. Using the
Jython/Python traditional "if" approach was a lot easier. I had done
this and it works. There are of course a lot of things left out such as
where the mouse is located but I was able to manipulate the location of
the selected cell. This pretty much answers my question though. Below is
the code I ended up using in case anyone wants to try and utilize it.
This one allows me to move multiple times. It doesn't check for invalid
"direction" or "loopvalue" variables, but can easily be done.

def grid_movement(direction, loopvalue):
  print "Executing 'grid_movement' function"
  wait(2)
  while(1):
    if loopvalue > 0: 
      print "Moving to new cell"
      if direction == 1:
        loopvalue = loopvalue - 1
        type(Key.RIGHT)
      elif direction == 2:
        loopvalue = loopvalue - 1
        type(Key.LEFT)
      elif direction == 3:
        loopvalue = loopvalue - 1
        type(Key.UP)
      elif direction == 4:
        loopvalue = loopvalue - 1
        type(Key.DOWN)
    else:
     print "Grid selection in that direction is completed"
     break

moveright = 1
moveleft = 2
moveup = 3
movedown = 4

grid_movement(moveright, 3)
grid_movement(movedown, 25)
grid_movement(moveleft, 3)
grid_movement(moveup, 25)

Thanks Railman.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.