xZZTx Posted March 5, 2009 Share Posted March 5, 2009 im starting AutoitX and i was just wondering how todo a few things #include <Windows.h> #include "AutoIt3.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int $T; $T = AU3_PixelSearch(0,0,1000,900,0xFF0000,NULL,NULL,NULL); if (AU3_error() == 0) { AU3_MouseMove($T[0],$T[1],NULL); } return 0; } Error 1>------ Build started: Project: test1, Configuration: Debug Win32 ------ 1>Compiling... 1>main.cpp 1>main.cpp(15) : error C2440: '=' : cannot convert from 'void' to 'int' 1> Expressions of type void cannot be converted to other types 1>main.cpp(18) : error C2109: subscript requires array or pointer type 1>main.cpp(18) : error C2109: subscript requires array or pointer type 1>Build log was saved at "file://Debug\BuildLog.htm" 1>test1 - 3 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Please Explane the error to me thank you in advanced Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 5, 2009 Share Posted March 5, 2009 You obviously don't know C++. If you knew C++, part of the error would be obvious. AU3_PixelSearch doesn't have a return code. You didn't pass a pointer to a point to receive the location of the found pixel. You are attempting to subscript an integer. There may be other errors but those are what I see immediately. Link to comment Share on other sites More sharing options...
xZZTx Posted March 5, 2009 Author Share Posted March 5, 2009 alright then.. could you please explane how i should write this, a few examples would help me learn this faster Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 6, 2009 Share Posted March 6, 2009 You should learn C++ first. Once you have that down, then you can extend it with other things. Link to comment Share on other sites More sharing options...
xZZTx Posted March 7, 2009 Author Share Posted March 7, 2009 i know i should learn C++ 1st but the thing is i don't really have time for that so with a simple syntex setup i could learn what i need/want to use Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 7, 2009 Share Posted March 7, 2009 (edited) Well there are two ways I could help you. I could just rewrite that small piece of code. Or you could ask specific questions and learn. I'd much rather you learn from it. #include <Windows.h> #include "AutoIt3.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { POINT T; AU3_PixelSearch(0,0,1000,900,0xFF0000,NULL,NULL,&T); if (AU3_error() == 0) { AU3_MouseMove(T.x,T.y,NULL); } return 0; } I want to say it's something like that. This is close anyways. Edited March 7, 2009 by Richard Robertson Link to comment Share on other sites More sharing options...
xZZTx Posted March 7, 2009 Author Share Posted March 7, 2009 Thank you for the help now i understand how part of this works..theres just a bit of a snag.. Unhandled exception at 0x1001b52b in Test.exe: 0xC0000005: Access violation reading location 0x00000008. Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 7, 2009 Share Posted March 7, 2009 Can you running in a debug mode? It should drop to a break point when you run that. Let me know at what line that error happens. Link to comment Share on other sites More sharing options...
xZZTx Posted March 7, 2009 Author Share Posted March 7, 2009 (edited) it brakes on IF and on MouseMove and T.x & T.y are returning numbers so that can't be the error Edited March 7, 2009 by xZZTx Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 7, 2009 Share Posted March 7, 2009 Try using -1 instead of NULL on the mouse move. Link to comment Share on other sites More sharing options...
xZZTx Posted March 8, 2009 Author Share Posted March 8, 2009 still not working...have you tried the code yourself? maybe its jsut my settings Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 8, 2009 Share Posted March 8, 2009 Nope. I don't ever use AutoItX. I just try to help if I can. I'll look at it again after dinner. Link to comment Share on other sites More sharing options...
Authenticity Posted March 10, 2009 Share Posted March 10, 2009 Don't send the parameter for the step to null, it's supposed to incremented each iteration so 0 probably is causing the error, send 1, it's the default. Even though, I don't know if this is the reason. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 10, 2009 Share Posted March 10, 2009 That would make sense actually. I just never use AutoItX and didn't even bother looking at the help file deeply. Link to comment Share on other sites More sharing options...
xZZTx Posted March 10, 2009 Author Share Posted March 10, 2009 AU3_PixelSearch is the error even if i don't use what it outputs it makes it error { POINT T; AU3_PixelSearch(1,1,1000,900,0xFF0000,30,1,&T); if (AU3_error() == 0) { int T1 = 300;//T.x; int T2 = 900;//T.y; AU3_MouseMove(T1,T2,1);//Error on this line } } as to { POINT T; //AU3_PixelSearch(1,1,1000,900,0xFF0000,30,1,&T); if (AU3_error() == 0) { int T1 = 300;//T.x; int T2 = 900;//T.y; AU3_MouseMove(T1,T2,1);//No Error At All } } Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
Authenticity Posted March 11, 2009 Share Posted March 11, 2009 Dunno why it's referring to and causing this access violation like MOV ECX, [EAX+8] and EAX is 00000000.... Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 11, 2009 Share Posted March 11, 2009 Try changing it to POINT *T = new POINT(); AU3_PixelSearch(1,1,1000,900,0xFF0000,30,1,T); And then change T.x to T->x and T.y to T->y. See if that works. Link to comment Share on other sites More sharing options...
Authenticity Posted March 11, 2009 Share Posted March 11, 2009 I can't be right but maybe no check is done in the function for null pointers? or nothing like __try..._except? Link to comment Share on other sites More sharing options...
xZZTx Posted March 11, 2009 Author Share Posted March 11, 2009 still didn't work... could we get a AutoitX expert down here.. Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. 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