JMacro Script Help
By Woody
Table of Contents
- 1.0 Introduction
- 2.0 Creating Scripts
- 2.01 FindColor
- 2.02 LeftClick/RightClick
- 2.03 LeftDown
- 2.04 LeftUp
- 2.05 RightDown
- 2.06 RightUp
- 2.07 MoveMouse
- 2.08 Pause
- 2.09 Print
- 2.10 SendKey
- 2.11 FindEnt
- 3.0 Compiling Scripts
- 4.0 Running Scripts
- 5.0 How to find RGB
1.0 Introduction
Welcome, Im making this guide in the hopes that this will be the first version of what may become the documentation for Speedsters JMacro bot. Also this might help the tons of messages he gets from people needing help. I also dont expect people to read this linearly. So without further ado let the guide begin.
2.0 Creating Scripts
The Creation of a script is somewhat simple but if you don't do it right your scripts wont work.
First Open up Notepad
Then go to File > Save As

Find the scripts directory of Jmacro. Save the file with your script name and a ".java" after it. Make sure that you select "all files" under the file type option.
Now to start your script. There are 3 lines that it must contain for it to work properly.
1.
package scripts;
Before importing any .class functions you must tell the script to include them with this line.
2.
public class ScriptName {
This is the start of your script and is very important. The "ScriptName" part of the line must be exactly the same as your filename in order for the script to compile correctly.
3.
public static void jbot() {
Place this right under the public class line. It merely tells the program that this is to be run by JMacro.
Now to add Functions to your script.
2.01 FindColor
import static com.vibesoft.bots.findcolor.findcolor;
Add this function by placing the above line after the package scripts line.
Function Syntax: findcolor(R,G,B,R Tolerance,G Tolerance, B Tolerance,Case);
How it works:
This searches for an RGB color within the R,G or Btolerance (+ or -) and which pixel (in the even their are more than one of the same pixel) to choose in order from left to right and down. Default tolerance for a script is 1, it must be one or more always.
2.02 LeftClick/RightClick
import static com.vibesoft.bots.leftclick.leftclick;
import static com.vibesoft.bots.rightclick.rightclick;
Add this function by placing the above line after the package scripts line.
Function Syntax: rightclick();
How it works:
This right clicks the mouse at the position it is over.
Function Syntax: leftclick();
How it works:
This left clicks the mouse at the position it is over.
2.03 LeftDown
import static com.vibesoft.bots.leftdown.leftdown;
Add this function by placing the above line after the package scripts line.
Function Syntax: leftdown();
How it works:
Holds the left mouse button down.
2.04 LeftUp
import static com.vibesoft.bots.leftup.leftup;
Add this function by placing the above line after the package scripts line.
Function Syntax: leftup();
How it works:
Releases the left mouse button.
2.05 RightDown
import static com.vibesoft.bots.rightdown.rightdown;
Add this function by placing the above line after the package scripts line.
Function Syntax: rightdown();
How it works:
Holds down the right mouse button.
2.06 RightUp
import static com.vibesoft.bots.rightup.rightup;
Add this function by placing the above line after the package scripts line.
Function Syntax: rightup();
How it works:
Releases the right mouse button.
2.07 MoveMouse
import static com.vibesoft.bots.movemouse.movemouse;
Add this function by placing the above line after the package scripts line.
Function Syntax: movemouse(x,y);
How it works:
This moves the mouse to the specified X,Y position on the screen.
2.08 Pause
import static com.vibesoft.bots.pause.pause;
Add this function by placing the above line after the package scripts line.
Function Syntax: pause(ms);
How it works:
Pauses the script for the specified period of time in milliseconds.
2.09 Print
import static com.vibesoft.bots.print.print;
Add this function by placing the above line after the package scripts line.
Function Syntax: print("String of text");
How it works:
Print's the specified string of text to the "black box" or "JVM" or "log"
2.10 SendKey
import static com.vibesoft.bots.sendkey.sendkey;
Add this function by placing the above line after the package scripts line.
Function Syntax: sendkey("");
How it works:
This sends A SINGAL KEY to the board.
Also includes:
ENTER
SHIFT
2.11 FindEnt
import static com.vibesoft.bots.findent.findent;
Add this function by placing the above line after the package scripts line.
Function Syntax: findent();
How it works:
Returns a boolean, (true or false), of whether or not a tree entity is under the mouse cursor. (85% accuracy rate)
3.0 Compiling Scripts
Once you have created your script then you are read to compile it into the class file that JMacro uses.
Return to the origin folder and find the files named "Compile-JDK 6, Up 3" and "Compile-JDK 6, Up 2."
First open the "Compile-JDK 6, Up 3" file. Some text should come up and after a bit of time it should look like this.

If you see that the congratulation's you have created your brand new script for JMacro. If you get something else read on.
If you get this error message then use the "Compile-JDK 6, Up 2" program.
If you are getting another error message then look at section 3.1 for more help.
3.1 Error Messages
This is not meant to be all inclusive but I will add to it as people report errors and Speedster or other smart people answer them.
class **** is public, should be declared in a public class
This is caused because your file name does not match the name in the "public class" line. Ensure that both of these are the same and remember it's case sensitive.
";" expected
Just add a semi-colon at the end of the line mentioned.
cannot find symbol
symbol : variable
This is because you forgot to add parentheses to the sendkey command.
cannot find symbol
symbol : method sendkey(java.lang.string)
This is because you forgot to add the class include for sendkey at the beginning of the script.
cannot find symbol
symbol : method findcolor(int,int,...)
This is because you forgot to add the class include for findcolor at the beginning of the script.
4.0 Running Scripts
Really basic and im fealing lazy atm but I'll add something to this tomorrow.
5.0 How to find RGB
Since I have seen people wondering how you find the RGB color of an object I'm adding this. Speedster says he will be adding a script to JMacro that will tell you what the RGB of something is in the near future.
5.1 Paint
Everyone with a PC has this program(hopefully) so this is the fastest way to get a colors RGB
To find out RGB color value, use Paint program included into standard Windows package.
* Launch Paint; open an image containing the needed color
* Go to Instruments panel; select Picker instrument
* Click the needed color to select it. This color will appear in the palette as brush color
* In the "Colors" section of the main menu, select "Edit Colors" menu item
* Press "Define custom colors" button. The window will expand to present the color you have selected as well as its RGB numeric values for every channel.
Images Soon
5.2 Photoshop
If you have photoshop this method is handy since you can quickly change colors unlike in paint.
Simply open the image your trying to get the RGB of.
Use the color picker tool and the exact RGB should appear in the color tab of the toolbar.
Images Soon