public class MonkeyScript extends Object
Constructor and Description |
---|
MonkeyScript()
Class constructor.
|
MonkeyScript(String filename)
Class constructor.
|
MonkeyScript(String filename,
Vector<String> arguments)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addArgument(BufferedImage image,
int index)
Add an argument to be typed in when executed (note this versions enforces a required desktop!).
|
void |
addArgument(int index)
Add an argument to be typed in when executed.
|
void |
addClick(BufferedImage image,
int x,
int y)
Add a mouse click.
|
void |
addCommand(String command)
Add a command to execute.
|
void |
addDesktop(BufferedImage image)
Add a desktop image to the script.
|
void |
addDoubleClick(BufferedImage image,
int x,
int y)
Add a mouse double click.
|
void |
addKey(char c)
Add characters as input from the keyboard.
|
void |
addLine(String line)
Add a line to the script.
|
void |
addNegativeArea(int[] box)
Add a negative area for the NEXT captured desktop image!
|
void |
addPositiveArea(int[] box)
Add a positive area for the NEXT captured desktop image!
|
void |
addTarget(int[][] image)
Add a target image to the script.
|
void |
addTargetClick(int[][] image,
int x0,
int y0,
int x,
int y)
Add a target mouse click.
|
void |
addText(BufferedImage image,
String text)
Add text input from the keyboard (note this versions enforces a required desktop!).
|
void |
addText(String text)
Add text input from the keyboard.
|
void |
addToLastLine(char c)
Add a character to the last line of the script.
|
void |
execute()
Execute the script.
|
String |
getAlias()
Get the script alias.
|
String |
getName()
Get the name of the script.
|
Vector<int[]> |
getNegativeAreas()
Get the current set of negative areas.
|
String |
getOperation()
Get the operation the script performs.
|
Vector<int[]> |
getPositiveAreas()
Get the current set of positive areas.
|
void |
lastClickToDoubleClick()
Upgrade the last single click to a double click.
|
String |
lastLine()
Get the last line of the script.
|
int |
length()
Get the number of lines in the script.
|
void |
load(String filename)
Load a script.
|
static void |
main(String[] args)
A main to execute a monkey script from the command line.
|
void |
print()
Display this script.
|
void |
save(String path)
Save the script to the given path.
|
void |
set(int index,
String line)
Set a line of the script.
|
void |
setAlias(String alias)
Set the script alias.
|
void |
setOperation(String operation)
Set the operation the script will perform.
|
void |
startFocusThief(int focus_thief_delay)
Start up an iconified JFrame for the sole purpose of stealing screen focus when needed.
|
boolean |
stealFocus(int desktop_index)
Steal window focus as best as possible.
|
public MonkeyScript()
public MonkeyScript(String filename)
filename
- the filename of the script to loadpublic void startFocusThief(int focus_thief_delay)
focus_thief_delay
- the time in milliseconds to wait before trying to use the focus thief when executing a stalled scriptpublic void setAlias(String alias)
alias
- the script aliaspublic void setOperation(String operation)
operation
- the script operationpublic String getAlias()
public String getOperation()
public String getName()
public int length()
public void addLine(String line)
line
- the line to addpublic void addToLastLine(char c)
c
- the character to addpublic void addDesktop(BufferedImage image)
image
- the image to addpublic void addPositiveArea(int[] box)
box
- the bounding box of the desired area as (minx, miny, maxx, maxy)public void addNegativeArea(int[] box)
box
- the bounding box of the desired area as (minx, miny, maxx, maxy)public void addTarget(int[][] image)
image
- the image to addpublic void addCommand(String command)
command
- the command to executepublic void addClick(BufferedImage image, int x, int y)
image
- the desktop before the clickx
- the x-coordinatey
- the y-coordinatepublic void addTargetClick(int[][] image, int x0, int y0, int x, int y)
image
- the target with which the click is in reference tox0
- the x-coordinate of the target locationy0
- the y-coordinate of the target locaitonx
- the x-coordinate of the click on the desktopy
- the y-coordinate of the click on the desktoppublic void addDoubleClick(BufferedImage image, int x, int y)
image
- the desktop before the clickx
- the x-coordinatey
- the y-coordinatepublic void lastClickToDoubleClick()
public void addKey(char c)
c
- the character to addpublic void addText(String text)
text
- the text to addpublic void addText(BufferedImage image, String text)
image
- the desktop before the clicktext
- the text to addpublic void addArgument(int index)
index
- the argument indexpublic void addArgument(BufferedImage image, int index)
image
- the desktop before the clickindex
- the argument indexpublic void set(int index, String line)
index
- the index of the line to setline
- the new linepublic String lastLine()
public Vector<int[]> getPositiveAreas()
public Vector<int[]> getNegativeAreas()
public void save(String path)
path
- the path to save the script topublic void load(String filename)
filename
- the filename of the scriptpublic void print()
public boolean stealFocus(int desktop_index)
desktop_index
- the index of the current required desktop imagepublic void execute()
public static void main(String[] args)
args
- command line argumentsCopyright © 2014. All rights reserved.