Jump to content
Sign in to follow this  
xZZTx

AutoitX Help

Recommended Posts

xZZTx

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..

Share this post


Link to post
Share on other sites
Richard Robertson

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.

Share this post


Link to post
Share on other sites
xZZTx

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..

Share this post


Link to post
Share on other sites
Richard Robertson

You should learn C++ first. Once you have that down, then you can extend it with other things.

Share this post


Link to post
Share on other sites
xZZTx

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..

Share this post


Link to post
Share on other sites
Richard Robertson

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 by Richard Robertson

Share this post


Link to post
Share on other sites
xZZTx

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..

Share this post


Link to post
Share on other sites
Richard Robertson

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.

Share this post


Link to post
Share on other sites
xZZTx

it brakes on IF and on MouseMove

and T.x & T.y are returning numbers so that can't be the error

Edited by xZZTx

Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times..

Share this post


Link to post
Share on other sites
Richard Robertson

Try using -1 instead of NULL on the mouse move.

Share this post


Link to post
Share on other sites
xZZTx

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..

Share this post


Link to post
Share on other sites
Richard Robertson

Nope. I don't ever use AutoItX. I just try to help if I can. :P

I'll look at it again after dinner.

Share this post


Link to post
Share on other sites
Authenticity

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.

Share this post


Link to post
Share on other sites
Richard Robertson

That would make sense actually. I just never use AutoItX and didn't even bother looking at the help file deeply.

Share this post


Link to post
Share on other sites
xZZTx

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..

Share this post


Link to post
Share on other sites
Authenticity

Dunno why it's referring to and causing this access violation like MOV ECX, [EAX+8] and EAX is 00000000....

Share this post


Link to post
Share on other sites
Richard Robertson

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.

Share this post


Link to post
Share on other sites
Authenticity

I can't be right but maybe no check is done in the function for null pointers? or nothing like __try..._except? :P

Share this post


Link to post
Share on other sites
xZZTx

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..

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.