wangzhengbo Posted July 19, 2015 Share Posted July 19, 2015 I use AutoItX in java.AU3_PixelSearch work well with AutoItX 3.3.12.0 or 3.3.10.2, but throw Invalid nemory access error with 3.3.14.0? Link to comment Share on other sites More sharing options...
JohnOne Posted July 19, 2015 Share Posted July 19, 2015 Might be a bit easier for people to answer if you posted your code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wangzhengbo Posted July 21, 2015 Author Share Posted July 21, 2015 expandcollapse popuppackage cn.com.jautoitx; import java.io.File; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.platform.win32.WinDef.POINT; import com.sun.jna.platform.win32.WinDef.RECT; /** * * * @author zhengbo.wang */ public class AutoItX { public static void main(String[] args) { File libFile = new File("lib/AutoItX3.dll"); System.load(libFile.getAbsolutePath()); AutoItXLibrary autoItX = (AutoItXLibrary) Native.loadLibrary(libFile.getName(), AutoItXLibrary.class); RECT rect = new RECT(); rect.left = 0; rect.top = 0; rect.right = 100; rect.bottom = 100; POINT point = new POINT(); autoItX.AU3_PixelSearch(rect, 0xFFFFFF, 0, 1, point); System.out.println("point.x = " + point.x + ", point.y = " + point.y); } protected static interface AutoItXLibrary extends Library { /** * Searches a rectangle of pixels for the pixel color provided. * * @param rect * position and size of rectangle. * @param color * Colour value of pixel to find (in decimal or hex). * @param shadeVariation * A number between 0 and 255 to indicate the allowed number * of shades of variation of the red, green, and blue * components of the colour. Default is 0 (exact match). * @param step * Instead of searching each pixel use a value larger than 1 * to skip pixels (for speed). E.g. A value of 2 will only * check every other pixel. Default is 1. * @param point * Return the pixel's coordinates if success, sets * oAutoIt.error to 1 if color is not found. */ public void AU3_PixelSearch(RECT rect, int color, Integer shadeVariation, Integer step, POINT point); } }I write a simple java program。You can download AutoItXDemo.zip and import it into eclipse and run it.The AutoItX contained in AutoItXDemo.zip is 3.3.12.0, and the output of the code is something like:point.x = 0, point.y = 45but when i use AutoItX 3.3.14.0, invalid memory access error happened. AutoItXDemo.zip Link to comment Share on other sites More sharing options...
wangzhengbo Posted July 28, 2015 Author Share Posted July 28, 2015 Might be a bit easier for people to answer if you posted your code.See my post below. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now