Jump to content

find color - do action problems


 Share

Recommended Posts

Hi all,

I'm trying to create a program where it searches an area for a specific color, and then if it does so, it performs another action where it searches another area for another color and clicks it if found. Here is the code:

 


Func findColor()
   
   While 1
      $point = PixelSearch(2516, 135, 2532, 150, 0xF00B09)
      if IsArray($point) Then
        MouseClick("right", $point[0], $point[1])
         Sleep(500)
         $point2 = PixelSearch(2278, 300, 2514, 633, 0xA0315B)
            if IsArray($point2) Then
                MouseClick("left", $point2[0], $point2[1])
            EndIf
      EndIf
      Sleep(50)
   WEnd
EndFunc
 

 

Any help would be lovely

 

 

Link to comment
Share on other sites

Code seems fine. Although you have to realize PixelSearch is a bit slow and can't detect pixels drawn using certain methods. DirectX being an example I believe.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Just now, rcmaehl said:

Code seems fine. Although you have to realize PixelSearch is a bit slow and can't detect pixels drawn using certain methods. DirectX being an example I believe.

I've used pixel search on the same application before without any problems. This one it doesn't do anything, just runs until i quit the program.

Link to comment
Share on other sites

Honestly the code is fine which means one or more of the following:

  • PixelSearch is searching for the wrong color code
  • PixelSearch is searching the wrong window
  • PixelSearch is searching the wrong area
  • PixelSearch is being called too often and throttling
Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Try adding some tolerance and see what happens.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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