nullmastermind / node-autoit-koffi

This Node.js module provides support for all AutoIt functions, allowing users to automate Windows GUI tasks seamlessly.
8 stars 2 forks source link

How to use the pixelsearch function? #1

Open AlloryDante opened 3 months ago

AlloryDante commented 3 months ago

Hello, I am trying the pixelSearch function but it seems its not working. I've tested same function directly in Autoit and it finds the pixel but if I pass it trough your wrapper it always returns x:0 y:0 (incorect location)

This is my code

const autoit = require("node-autoit-koffi");

async function test() {
  await autoit.init();

  console.log(
    await autoit.pixelSearch(
      {
        left: 0,
        top: 0,
        right: 2560,
        bottom: 1080,
      },
      0xe64032
    )
  );
}

(async () => {
  await test();
})();

Am I doing something wrong?

Edit: I also tried with decimal numbers; Using node 20.14.0

AlloryDante commented 3 months ago

image

AlloryDante commented 3 months ago

Also I found this: If I put console.log(await autoit.mouseGetPos()); before it the pixel search returns empty object {} instead of {x:0,y:0}

image

LeninZapata commented 3 months ago

Hello, are you doing this so you can click on an element at different random points? ghost-cursor not working well?

nullmastermind commented 3 months ago

I'm not tested yet. Maybe I'll check later. This library code is auto-generated from AutoIt header file, so if other functions work but Pixel doesn't work, I think the error is from AutoIt DLL.

AlloryDante commented 3 months ago

Probably it requiers another dependecy or something. I am using Windows 10 and running pixelscan works within a normal Autoit Script. I also tried replacing the .dll and also runed the script as Admin and its still the same problem....

In the meantime I found a workaround, but it would be nice to see if you can replicate the issue.