Jump to content
MrMajorThorburn

Cant get pixelsearch to work in Windows 10

Recommended Posts

MrMajorThorburn

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?

Share this post


Link to post
Share on other sites
JLogan3o13

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


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
MrMajorThorburn

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?

 

 

Share this post


Link to post
Share on other sites
JLogan3o13
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.

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
RoundChecker

MrMajorThorburn, we could gladly help you with your request but first you would have to actually provide information about why are you trying to use pixelsearch? For what purpose is it?

If you can give me details about what you want to use it for then I'll gladly help you

Share this post


Link to post
Share on other sites
MrMajorThorburn

Its ok. I was not aware of the restriction of use of autoit.

I will establish a business scenario and see if I get the same problem and if so raise a new request for help.

I will be able to supply full disclosure that way.

Thanks for your interest and guidance.

Be back soon in another request.

Share this post


Link to post
Share on other sites
JLogan3o13

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.

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Similar Content

    • dwaynek
      By dwaynek
      traytip isn't working in windows 10. nothing happens when i use the Traytip command.
      here's a simple script i used:
      TrayTip("I'm a title", "I'm the message", 5) i tried changing the registry setting HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced ( which didn't have EnableBalloonTips) and creating a DWORD entry called EnableBalloonTips and setting it to 1 and logging off then back in. that did not resolve the problem.
      i'm running Windows 10 v1709 b16299.431
    • antonioj84
      By antonioj84
      Hi all to the forum guru and expert I am trying to  automate this. in the registry  I have the network profile name network 2 and network   I want to  change their  CATEGORY  to Private .  Can someone lead me in the right direction.
      Private is 1 and Public is 0
      #RequireAdmin Global $sHKLMRoot = @OSArch = "x64" ? "HKLM64" : "HKLM" RegWrite($sHKLMRoot &"\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" ,'/v NetworkList /t REG_MULTI_SZ /d 00000000 /f') see  attached picture below
      Much appreaciate
       

    • PhoenixPRO
      By PhoenixPRO
      When I try to automate this install program I can not get any of the buttons to click with the "ControlClick" function or any mouse movement to move the mouse to the and click it.  My OS is Windows 10 64Bit.  I have tried both 32bit and 64bit installs of Autoit V3 to no avail.
      I could not even get the run command to start the program until I used the variation of the command below in the script.
      With the script below the install program starts but will not click the "Next" button no matter what I do.
      Any help will be greatly appreciated.
      Thanks in advance.
       
      #include <MsgBoxConstants.au3>
      Opt("MouseCoordMode", 0) ;1=absolute, 0=relative to active window, 2=client
      Local $Success
      Run(@ComSpec & " /c " & 'C:\PhoenixPro_Install\RDXUtil\RDX_Tools_setup.exe', "C:\PhoenixPro_Install\RDXUtil", @SW_HIDE )

      WinWait("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62")
      WinActivate("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62")
      ControlClick ("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62", 1639, "left", 1) ;Next Button
    • Daka
      By Daka
      I find it very weird:
      if I run like this:
           Local $aCoord = PixelSearch($posX, $posY, $sizeX, $sizeY, '0xFF455E')
      works fine!
      If I run like this:
          Local $metaColor1 = '0xFF455E' or like this Local $metaColor1 = "0xFF455E" or Local $metaColor1 = "'0xFF455E'"
          Local $aCoord = PixelSearch($posX, $posY, $sizeX, $sizeY, $color)
      it doesn't want to work! So something with variable is not working and yes if I print it out like this:
      ConsoleWrite(@LF & $posX & ":"& $posY & ":"& $sizeX & ":" & $sizeY & ":" & $color&@LF)
      771:80:833:151:0xFF455E

      So I dont see the problem, maybe some of you people?
    • TheWizEd
      By TheWizEd
      How do I work with 2D arrays.  I've tried this but get errors.
      Local $aTest[4][4] = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
      ;$aTest[0][] = [10,11,12]  ; Error at []
      Local $sTest = ""
      For $i = 0 To UBound($aTest)-1
        Local $aExtract = _ArrayExtract($aTest,$i,$i)
        $sTest = $sTest & MyTest($aExtract)
      Next
      Func MyTest($aTemp)
        _ArrayDisplay($aTemp)
        ; Error at    v $aTemp
        Return String($aTemp[0]) & " - " & String($aTemp[1]) & " - " & String($aTemp[2]) & @CRLF
      EndFunc
       
       
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.