← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #277315]: Can't get onAppear to work.

 

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

    Status: Open => Solved

Spencer Keller confirmed that the question is solved:
I figured it out from the JavaDoc.  I was not starting an observer
thread.  Duh.

Thanks,
Spence
---------------------------------


import org.sikuli.script.ObserveEvent;
import org.sikuli.script.ObserverCallBack;
import org.sikuli.script.Screen;

public class SikulixEval
   {
   public static void main(String[] args)
      {
      Screen screen = new Screen();
      try
         {
         screen.onAppear("images/ColorPicker.png", new ObserverCallBack()
            {
               @Override
               public void appeared(ObserveEvent event)
                  {
                  try
                     {
                     System.out.println("Handler called.");
                     event.getRegion().stopObserver();
                     }
                  catch (Exception exc)
                     {
                     }
                  }
            });
         screen.click("images/StartButton.png");
         Thread.sleep(5000);
         screen.observe();   // <----- Started an observer.
         Thread.sleep(10000);
         }
      catch (Exception e)
         {
         }
      System.out.println("Finished.");
      }
   }

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