Jump to content

Pixel Search Help


Recommended Posts

Hi there, I've been using AutoIt for a very short time and I have found nothing on running multiple Pixel Search functions at the same time.

I was wondering if it was even possible to run them simultaneously?

This is a snipit from my program at the moment.

Dim $location = PixelSearch($Left, $Top, $Right, $Bottom, $Colour, 0, 3)

I want to basically run 1-5 of these at the same time. and each one to scan a different section of the screen.

Would it be resource heavy?

Any help would be much appreciated :)

Edited by Jonneh
Link to comment
Share on other sites

  • Moderators

As AutoIt is single threaded, you're not going to get multiple actions at once, no. The bigger question is just what you are trying to accomplish. Most people who begin trying to manipulate an application or window using PixelSearch find in short order that there are much easier (and more stable) ways of accomplishing what they want to do. Can you explain more about what you want to do with your program, or post what you have thus far?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

The program waits for the user to select the Pixel colour to find, the pixel search then finds that exact pixel on the screen

Func GetPixel()
    $pos = MouseGetPos()
    Global $Colour = PixelGetColor(MouseGetPos(0), MouseGetPos(1))
    Sleep(250)
EndFunc

While True
    $hHandle = WinGetHandle("MyProcess")
    If $Active = True Then
        ToolTip("Active", 0, 0)
        Dim $location = PixelSearch($Left, $Top, $Right, $Bottom, $Colour, 0, 3)
        If Not @error Then
            ControlClick($hHandle, "", "#327701", "right", 1, $location[0], $location[1])
            Sleep(Random(10, 150, 1))
        EndIf
    EndIf
WEnd

It just needs to run multiple instances of the search at the same time to make it faster at finding it and clicking it.

If it's not possible to run the search multiple times from the same code, is it possible to do something like in VB where you can call a DLL that calls another X amount of DLL files all with the same function? Or would i have to run several scripts at the same time?

Edited by Jonneh
Link to comment
Share on other sites

my only problem with that is the clashing hotkeys, there is the hotkey for the pixel, a stop key so you can stop looking for that pixel and chose a new one and the end script hotkey... I dont fancy pressing 12-15 keys... do you know any work arounds?

Link to comment
Share on other sites

$location = PixelSearch($Left, $Top, $Right, $Bottom, $Colour, 0, 3)
If @error then Exit 0
IniWrite("ini.ini", "section", "x", $location[0])
IniWrite("ini.ini", "section", "y", $location[1])
Exit 1

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


It just needs to run multiple instances of the search at the same time to make it faster at finding it and clicking it.

 


The program waits for the user to select the Pixel colour to find

 

I don't believe a user selecting pixel colours can do that faster than autoit finding the given pixels, you can't do a multi searching process if the script has already finished searching for the 1st colour.

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