org.sikuli.script
Class Region

java.lang.Object
  extended by org.sikuli.script.Region
Direct Known Subclasses:
Match, Screen

public class Region
extends Object


Field Summary
protected  double _autoWaitTimeout
           
protected  FindFailedResponse _defaultFindFailedResponse
           
protected  EventManager _evtMgr
           
protected  Match _lastMatch
           
protected  Iterator<Match> _lastMatches
           
protected  ScreenImage _lastScreenImage
           
protected  boolean _observing
           
protected  boolean _throwException
           
 int h
           
 int w
           
 int x
           
 int y
           
 
Constructor Summary
protected Region()
           
  Region(int x_, int y_, int w_, int h_)
           
  Region(Rectangle r)
           
  Region(Region r)
           
 
Method Summary
 Region above()
           
 Region above(int range)
           
 Region below()
           
 Region below(int range)
           
<PSRML> int
click(PSRML target, int modifiers)
           
<PSRML> int
doubleClick(PSRML target, int modifiers)
           
<PSRML> int
drag(PSRML target)
           
<PSRML> int
dragDrop(PSRML t1, PSRML t2, int modifiers)
           
<PSRML> int
dropAt(PSRML target, double delay)
           
<PSC> Match
exists(PSC target)
           
<PSC> Match
exists(PSC target, double timeout)
          Match exists(Pattern/String/PatternClass target, timeout-sec) waits until target appears or timeout (in second) is passed.
<PSC> Match
find(PSC target)
          Match find( Pattern/String/PatternClass ) finds the given pattern on the screen and returns the best match.
<PSC> Iterator<Match>
findAll(PSC target)
          Iterator findAll( Pattern/String/PatternClass ) finds the given pattern on the screen and returns the best match.
<PSC> Iterator<Match>
findAllNow(PSC ptn)
          Match findAllNow( Pattern/String/PatternClass ) finds the given pattern on the screen and returns the best match without waiting.
<PSC> Match
findNow(PSC ptn)
          Match findNow( Pattern/String/PatternClass ) finds the given pattern on the screen and returns the best match without waiting.
 double getAutoWaitTimeout()
           
 Location getBottomLeft()
           
 Location getBottomRight()
           
 Location getCenter()
           
protected  EventManager getEventManager()
           
 FindFailedResponse getFindFailedResponse()
           
 int getH()
           
 Match getLastMatch()
           
 Iterator<Match> getLastMatches()
           
<PSRML> Location
getLocationFromPSRML(PSRML target)
           
 Rectangle getRect()
           
<PSRM> Region
getRegionFromPSRM(PSRM target)
           
 Rectangle getROI()
           
 Screen getScreen()
           
 boolean getThrowException()
           
 Location getTopLeft()
           
 Location getTopRight()
           
 int getW()
           
 int getX()
           
 int getY()
           
 void highlight()
           
protected  void highlight(boolean toEnable)
           
 void highlight(float secs)
           
<PSRML> int
hover(PSRML target)
           
 Region inside()
           
 void keyDown(String keys)
           
 void keyUp(String keys)
           
 Region left()
           
 Region left(int range)
           
 Region morphTo(Region r)
           
 void mouseDown(int buttons)
           
 void mouseUp(int buttons)
           
 Region moveTo(Location loc)
           
 Region nearby()
           
 Region nearby(int range)
           
 void observe()
           
 void observe(double secs)
           
 void observeInBackground(double secs)
           
 Region offset(Location loc)
           
<PSC> void
onAppear(PSC target, SikuliEventObserver observer)
           
 void onChange(int threshold, SikuliEventObserver observer)
           
 void onChange(SikuliEventObserver observer)
           
<PSC> void
onVanish(PSC target, SikuliEventObserver observer)
           
<PSRML> int
paste(PSRML target, String text)
           
 Region right()
           
 Region right(int range)
           
<PSRML> int
rightClick(PSRML target, int modifiers)
           
 void setAutoWaitTimeout(double sec)
           
 void setFindFailedResponse(FindFailedResponse res)
           
 void setH(int _h)
           
 void setRect(int X, int Y, int W, int H)
           
 void setRect(Rectangle roi)
           
 void setRect(Region roi)
           
 void setROI(int X, int Y, int W, int H)
           
 void setROI(Rectangle roi)
           
 void setROI(Region roi)
           
 void setThrowException(boolean flag)
           
 void setW(int _w)
           
 void setX(int _x)
           
 void setY(int _y)
           
 void stopObserver()
           
 String text()
           
 String toString()
           
<PSRML> int
type(PSRML target, String text, int modifiers)
           
protected  void updateSelf()
           
<PSC> Match
wait(PSC target)
           
<PSC> Match
wait(PSC target, double timeout)
          Match wait(Pattern/String/PatternClass target, timeout-sec) waits until target appears or timeout (in second) is passed
<PSC> Iterator<Match>
waitAll(PSC target, double timeout)
          Deprecated. 
<PSC> boolean
waitVanish(PSC target)
           
<PSC> boolean
waitVanish(PSC target, double timeout)
          boolean waitVanish(Pattern/String/PatternClass target, timeout-sec) waits until target vanishes or timeout (in second) is passed
 int wheel(int direction, int steps)
           
<PSRML> int
wheel(PSRML target, int direction, int steps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public int x

y

public int y

w

public int w

h

public int h

_defaultFindFailedResponse

protected FindFailedResponse _defaultFindFailedResponse

_throwException

protected boolean _throwException

_autoWaitTimeout

protected double _autoWaitTimeout

_observing

protected boolean _observing

_evtMgr

protected EventManager _evtMgr

_lastScreenImage

protected ScreenImage _lastScreenImage

_lastMatch

protected Match _lastMatch

_lastMatches

protected Iterator<Match> _lastMatches
Constructor Detail

Region

public Region(int x_,
              int y_,
              int w_,
              int h_)

Region

public Region(Rectangle r)

Region

public Region(Region r)

Region

protected Region()
Method Detail

setFindFailedResponse

public void setFindFailedResponse(FindFailedResponse res)

getFindFailedResponse

public FindFailedResponse getFindFailedResponse()

toString

public String toString()
Overrides:
toString in class Object

getEventManager

protected EventManager getEventManager()

updateSelf

protected void updateSelf()

getScreen

public Screen getScreen()

getX

public int getX()

getY

public int getY()

getW

public int getW()

getH

public int getH()

setX

public void setX(int _x)

setY

public void setY(int _y)

setW

public void setW(int _w)

setH

public void setH(int _h)

getROI

public Rectangle getROI()

setROI

public void setROI(int X,
                   int Y,
                   int W,
                   int H)

setROI

public void setROI(Region roi)

setROI

public void setROI(Rectangle roi)

highlight

public void highlight()

highlight

protected void highlight(boolean toEnable)

highlight

public void highlight(float secs)

getRect

public Rectangle getRect()

setRect

public void setRect(Rectangle roi)

setRect

public void setRect(int X,
                    int Y,
                    int W,
                    int H)

setRect

public void setRect(Region roi)

getCenter

public Location getCenter()

getTopLeft

public Location getTopLeft()

getTopRight

public Location getTopRight()

getBottomLeft

public Location getBottomLeft()

getBottomRight

public Location getBottomRight()

offset

public Region offset(Location loc)

moveTo

public Region moveTo(Location loc)

morphTo

public Region morphTo(Region r)

nearby

public Region nearby()

nearby

public Region nearby(int range)

right

public Region right()

right

public Region right(int range)

left

public Region left()

left

public Region left(int range)

above

public Region above()

above

public Region above(int range)

below

public Region below()

below

public Region below(int range)

inside

public Region inside()

setThrowException

public void setThrowException(boolean flag)

setAutoWaitTimeout

public void setAutoWaitTimeout(double sec)

getThrowException

public boolean getThrowException()

getAutoWaitTimeout

public double getAutoWaitTimeout()

find

public <PSC> Match find(PSC target)
           throws FindFailed
Match find( Pattern/String/PatternClass ) finds the given pattern on the screen and returns the best match. If AutoWaitTimeout is set, this is equivalent to wait().

Throws:
FindFailed

findAll

public <PSC> Iterator<Match> findAll(PSC target)
                        throws FindFailed
Iterator findAll( Pattern/String/PatternClass ) finds the given pattern on the screen and returns the best match. If AutoWaitTimeout is set, this is equivalent to wait().

Throws:
FindFailed

wait

public <PSC> Match wait(PSC target)
           throws FindFailed
Throws:
FindFailed

wait

public <PSC> Match wait(PSC target,
                        double timeout)
           throws FindFailed
Match wait(Pattern/String/PatternClass target, timeout-sec) waits until target appears or timeout (in second) is passed

Throws:
FindFailed

exists

public <PSC> Match exists(PSC target)

exists

public <PSC> Match exists(PSC target,
                          double timeout)
Match exists(Pattern/String/PatternClass target, timeout-sec) waits until target appears or timeout (in second) is passed. No FindFailed exception will be thrown even if the target is not found.


waitVanish

public <PSC> boolean waitVanish(PSC target)

waitVanish

public <PSC> boolean waitVanish(PSC target,
                                double timeout)
boolean waitVanish(Pattern/String/PatternClass target, timeout-sec) waits until target vanishes or timeout (in second) is passed

Returns:
true if the target vanishes, otherwise returns false.

click

public <PSRML> int click(PSRML target,
                         int modifiers)
          throws FindFailed
Throws:
FindFailed

doubleClick

public <PSRML> int doubleClick(PSRML target,
                               int modifiers)
                throws FindFailed
Throws:
FindFailed

rightClick

public <PSRML> int rightClick(PSRML target,
                              int modifiers)
               throws FindFailed
Throws:
FindFailed

wheel

public int wheel(int direction,
                 int steps)
          throws FindFailed
Throws:
FindFailed

wheel

public <PSRML> int wheel(PSRML target,
                         int direction,
                         int steps)
          throws FindFailed
Throws:
FindFailed

hover

public <PSRML> int hover(PSRML target)
          throws FindFailed
Throws:
FindFailed

dragDrop

public <PSRML> int dragDrop(PSRML t1,
                            PSRML t2,
                            int modifiers)
             throws FindFailed
Throws:
FindFailed

drag

public <PSRML> int drag(PSRML target)
         throws FindFailed
Throws:
FindFailed

dropAt

public <PSRML> int dropAt(PSRML target,
                          double delay)
           throws FindFailed
Throws:
FindFailed

type

public <PSRML> int type(PSRML target,
                        String text,
                        int modifiers)
         throws FindFailed
Throws:
FindFailed

paste

public <PSRML> int paste(PSRML target,
                         String text)
          throws FindFailed
Throws:
FindFailed

mouseDown

public void mouseDown(int buttons)

mouseUp

public void mouseUp(int buttons)

keyDown

public void keyDown(String keys)

keyUp

public void keyUp(String keys)

onAppear

public <PSC> void onAppear(PSC target,
                           SikuliEventObserver observer)

onVanish

public <PSC> void onVanish(PSC target,
                           SikuliEventObserver observer)

onChange

public void onChange(int threshold,
                     SikuliEventObserver observer)

onChange

public void onChange(SikuliEventObserver observer)

observe

public void observe()

observeInBackground

public void observeInBackground(double secs)

stopObserver

public void stopObserver()

observe

public void observe(double secs)

getLastMatch

public Match getLastMatch()

getLastMatches

public Iterator<Match> getLastMatches()

text

public String text()

findNow

public <PSC> Match findNow(PSC ptn)
              throws FindFailed
Match findNow( Pattern/String/PatternClass ) finds the given pattern on the screen and returns the best match without waiting.

Throws:
FindFailed

findAllNow

public <PSC> Iterator<Match> findAllNow(PSC ptn)
                           throws FindFailed
Match findAllNow( Pattern/String/PatternClass ) finds the given pattern on the screen and returns the best match without waiting.

Throws:
FindFailed

waitAll

@Deprecated
public <PSC> Iterator<Match> waitAll(PSC target,
                                                double timeout)
                        throws FindFailed
Deprecated. 

Iterator waitAll(Pattern/String/PatternClass target, timeout-sec) waits until target appears or timeout (in second) is passed

Throws:
FindFailed

getRegionFromPSRM

public <PSRM> Region getRegionFromPSRM(PSRM target)
                         throws FindFailed
Throws:
FindFailed

getLocationFromPSRML

public <PSRML> Location getLocationFromPSRML(PSRML target)
                              throws FindFailed
Throws:
FindFailed