Jump to content

Help pixelsearch dont work for me c#


eltwomen
 Share

Recommended Posts

i always used autoit it always worked fine the only function that never worked for me is: PixelSearch.
I really need this function it would save a lot of my time but I don't know what happens and it always crashes the code or gives some problem.
I use c#

 

static void Main(string[] args)
        {
            string window_title = "Sem título - Paint";//paint

            while (true)
            {
                int color = 15539236;
                Object searchcrash = AutoItX.PixelSearch(new Rectangle(663, 209, 1799, 846), color);//663, 209 = left_up | 1799, 846 = righ_down

 				object[] cord = searchcrash as object[];
                if (AutoIt.AutoItX.ErrorCode() != 1)
                {
                   AutoIt.AutoItX.MouseClick("LEFT", (int)cord[0], (int)cord[1]);
                   Thread.Sleep(5000);
                }
            }
        }

crash: System.AccessViolationException: 'Attempted to read or write to protected memory. This is usually an indication that other memory is corrupted.'
line: Object searchcrash = AutoItX.PixelSearch(new Rectangle(663, 209, 1799, 846), color);//663, 209 = left_up | 1799, 846 = righ_down

Link to comment
Share on other sites

  • 2 weeks later...

I really dont know c# but in Autoit:

PixelSearch(663, 209, 1799, 846,15539236)

it might be in C#:

     Object searchcrash = AutoItX.PixelSearch(663, 209, 1799, 846, color)

 

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...