Sign in to follow this  
Followers 0
christian11

AND operator using pixelgetcolor and pixelsearch wont work

4 posts in this topic

#1 ·  Posted (edited)

hello i'm here again i know im quite annoying because i ask nonsense questions >.<
i just wanted to improve my automated autoclicker yahoomail

I wanted to check if it is match pink and white color using AND operator && but i cant make it to work :(

im really newbie in programming ,i wanted to learn more, i hope you help me again

Func CheckIfMatch()
   $pink = PixelSearch(0, 0, @DesktopHeight, @DesktopWidth, 0x2f0326) && If PixelGetColor ( 1002 , 236 ) = 0xFFFFFF &&
   If isArray($pink) then
   Send("{F5}")
   MouseClick("primary", $pink[0] , $pink[1], 0, 0)
Else
   MouseClick("primary", $pink[0] , $pink[1], 0, 0)
EndIf
EndFunc

 

Edited by christian11

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Look through the language operators in the help file, do you see a double ampersand? Start there.

Try something like: If x AND y Then ...

Edited by JLogan3o13

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ok ill try ..is it okay?

its worked but it doesn't Mouseclick to $pink any idea why?

 

Func CheckIfMatch()
   $pink = PixelSearch(0, 0, @DesktopHeight, @DesktopWidth, 0x2f0326)
   $white = PixelGetColor ( 1002 , 236 ) 
   If isArray($pink) And $white = 0xFFFFFF  then
   Send("{F5}")
   MouseClick("primary", $pink[0] , $pink[1], 0, 0)
Else
   MouseClick("primary", $pink[0] , $pink[1], 0, 0)
EndIf
EndFunc
Edited by christian11

Share this post


Link to post
Share on other sites

Did you ever figure this out? Was it because your pixelSearch is looking only at @Desktop? Maybe it won't look at open windows with that... I'm not sure. I'd like to use the same type of command and wanted to verify if you got it working. Thanks

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • Nitrolord
      By Nitrolord
      I had this problem with PixelGetColor not giving me the same HEX Color as the AU3Info Tool and searched every were with no luck then had a OH DA moment LoL.
      The problem is that the
      "PixelGetColor ($mouseX[0], $mouseY[1])"
      is looking rite at the very tip of the mouse pointer not under it.  So you have to set a -3 after the [0] and [1].  
      "PixelGetColor ($mouseX[0] -3, $mouseY[1] -3)"
      to make it search next to the pointer not on the pointer.  You may have to adjust this a bit for your display but you should not have  to go more then -5.  -3 seems to work best for me.
      Example.au3
      #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 141, 127, 276, 231) $Input1 = GUICtrlCreateInput("", 8, 8, 121, 21) $Label1 = GUICtrlCreateLabel("Press or Hold F1 to get Hex color at Mouse X -3, Y-3 Pos,", 8, 40, 124, 73) GUISetState(@SW_SHOW) HotKeySet("{f1}","MousePos") Func MousePos() $aPos = MouseGetPos() $PGC = PixelGetColor($aPos[0] -3, $aPos[1] -3) GUICtrlSetData($Input1, "0x" & Hex($PGC, 6)) EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
    • DuyAnh
      By DuyAnh
      how to find the location on an image color ?? 
      Similar PixelSearch, but in a format bmp image

      search 0x0806EB and returns coordinates

      sorry I am not good at English
    • Tirk
      By Tirk
      PixelSearch in a GUI window which state's @SW_MINIMIZE.
      Is it possible?
    • Annonyreeder
      By Annonyreeder
      Hello,
      I've wrote a fairly straight forward script that will search an area of the screen and then left click on apart of that area should it find a certain color/pixel. 
      I have a small issue where by within the area, multiple pixels of the same color will appear, the script will continue to click on the same pixel over and over again. Is there a way so that it will cycle through all the results and click on each one for a given time period then move onto the next, as apose to clicking on the same spot forever. I have used timers before and that shouldn't be an issue, its more the having it stop clicking, or ignoring the current pixel its clicking and then moving onto the next one (same pixel color within same area).

      Hopefully this makes sense.
      [autoit]
      HotKeySet("{ESC}", "END_EXIT") HotKeySet("+1", "start") While 1     Sleep(100)  WEnd func start()    while 1 $location = PixelSearch( 631, 175, 1181, 597, 0xFF0000) If IsArray ($location) = 1 Then     MouseClick ('left', $location[0], $location[1], 1, 0)  EndIf  WEnd EndFunc  func END_EXIT()  Exit  EndFunc
       
      [/autoit]
    • Reizvoller
      By Reizvoller
      Greetings, 
      Func pixelHunter () Local $PixelHunt[2] Do $PixelHunt = PixelSearch (1, 1, 1016, 874, "0xCCE4CC", 0, 1, $sWorkOrderWin) Until $PixelHunt[0] > 0 EndFunc So when I call up this function in my app it fires back "Subscript used on non-accessible variable"
      Now, if I am understanding this message properly it is trying to tell me that the variable can't be seen by the function asking for it.
      I replaced "Do...Until" with simply a "ConsoleWrite" the $PixelHunt value and it doesn't throw that error.
      Any advice would be appreciated!
      -Reiz