Jump to content

Cant get pixelsearch to work in Windows 10


Recommended Posts

Using sample code:

#include <MsgBoxConstants.au3>
; Find a pure red pixel in the range 0,0-20,300
Local $aCoord = PixelSearch(0, 0, 20, 300, 0xFF0000)
If Not @error Then
    MsgBox($MB_SYSTEMMODAL, "", "X and Y are: " & $aCoord[0] & "," & $aCoord[1])
Else
    MsgBox($MB_SYSTEMMODAL, "", "Pure Not Found")
EndIf
; Find a pure red pixel or a red pixel within 10 shades variations of pure red
$aCoord = PixelSearch(0, 0, 20, 300, 0xFF0000, 10)
If Not @error Then
    MsgBox($MB_SYSTEMMODAL, "", "X and Y are: " & $aCoord[0] & "," & $aCoord[1])
Else
    MsgBox($MB_SYSTEMMODAL, "", "Variant Not Found")
EndIf
 
and the attached screenshot which has Pure Red (FF0000) in one icon in the area being searched.
screenshot.jpg
Would someone please check this out for me?
Link to comment
Share on other sites

  • Moderators

What application are you blocking from view? There is undoubtedly a better way to do this.

"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

I blanked out the app I was automating.

I afterwards realised that I was running my test where I run my automation, on a second screen.

If I move SciTE to the main screen the test works so I need to build a better example.

The problem I have is that the pixelsearch which is supplied the handle to the app window always returns the same location for the found (@error=0) pixel.

I am using the handle as the window is not on the same screen as SciTE.

Is the fact I'm running SciTE  on another screen perhaps the cause of my problem?

 

 

Link to comment
Share on other sites

  • Moderators
1 hour ago, MrMajorThorburn said:

I blanked out the app I was automating.

I don't think that was ever in question. I asked what app it is, because 99% of the time pixelsearch is not the way to go. There is almost always a better way to do it.

"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

  • Moderators

Before coming back please ensure you are familiar with the forum rules, as you obviously had not read them yet. Along with the restriction on game automation, please see this section:

Quote

Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above.

 

"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

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...