christian11

pixelsearch priority

13 posts in this topic

#1 ·  Posted (edited)

hello im newbie to this macro program. it is perfectly working fine, i wanted to loop clicking green button pixels until its gone to screen, however everytime there's 2 or more or another green pixel appeared. it clicks it even it is not successfully clicking the first pixel it sees until it disappear and and going nuts clicking any new green pixel it sees and appear.. could anyone suggest any idea how to achieve it?

f9TdXAa.gifv
 

Func MainLoop() 
While 1
$green = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x00ff00)
If isArray($green) then
MouseClick("primary", $green[0], $green[1] , 1, 0)

RefinedLoop(pX, pY)
}

RefinedLoop(pX, pY) {
 while 1 
         pX = X + 50
         pY = y + 50
         dX = X - 50
         dY = Y - 50
  

$green = PixelSearch($pX, $pY, $dX, $dY 0x00ff00)
If isArray($green) then
MouseClick("primary", $green[0], $green[1] , 1, 0)
            
            Else if @ErrorLevel <> 0
                i++
            If (i > 10)
                MainLoop()

 

output_7MRMgS.gif

 

Edited by christian11

Share this post


Link to post
Share on other sites



hi can you help me how to count pixelsearch? im new to this so please be gently :))

example if there is 3 or more green pixel appear in screen it will do some statements

$green = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x00ff00 )
If $green >= 3 then
       Send("{5}") ;--- refresh the browser
      Sleep(700)

   Else 
             do stuffs

 

 

 

Share this post


Link to post
Share on other sites

you keep posting all these new threads, and half of them you just let die without answering peoples questions.  What are you trying to automate?

Share this post


Link to post
Share on other sites

Better English would help a lot. More source code would also help a lot.

While 1
    $Pixel1 = PixelGetColor(x1,y1)
    $Pixel2 = PixelGetColot(x2,y2)
    $Pixel3 = PixelGetColot(x3,y3)    
    
    If $Pixel1 == Green Then
        MouseClick("",xcoord1,ycoord1)
    EndIf
    If $Pixel2 == Purple And $Pixel1 <> Green Then
        MouseClick("",xcoord2,ycoord2)
    EndIf
    If $Pixel3 == Blue And $Pixel1 <> Green Then
        MouseClick("",xcoord3,ycoord3)
    EndIf
    
    Sleep(1000)
WEnd

 


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Better coding would help ;) You have typos in your code plus you are doing string comparison (==) where a numeric comparison is needed. Green, Blue etc. should be variables or numeric values, right?
Just my 2 cents :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Actually I use this one a lot. Other than the color green being used instead of a dec or hex number, a == b translates to "if a is equal to b"


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

you keep posting all these new threads, and half of them you just let die without answering peoples questions.  What are you trying to automate?

because it seems no ones replying my previous thread yet so i decided make different one..

im trying to click buttons from a webpage

Share this post


Link to post
Share on other sites

But according to the help file '==' is a strict string comparison. You are comparing numbers. So AutoIt needs to do some extra processing. 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

because it seems no ones replying my previous thread yet so i decided make different one..

That is the wrong answer. Stick to a single thread and reply in there.
Topics merged.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

 

 

That is the wrong answer. Stick to a single thread and reply in there.Topics merged.

Jos

uhhgg no sir you misunderstood. the thread has far different question and different situation.. the one is counting pixel and priority pixel 

btw from priorty pixel

i've got an idea. can you suggest me if its okay? 

Func MainLoop() 
While 1
$green = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x00ff00)
If isArray($green) then
MouseClick("primary", $green[0], $green[1] , 1, 0)

RefinedLoop(pX, pY)
}

RefinedLoop(pX, pY) {
 while 1 
         pX = X + 50
         pY = y + 50
         dX = X - 50
         dY = Y - 50
  

$green = PixelSearch($pX, $pY, $dX, $dY 0x00ff00)
If isArray($green) then
MouseClick("primary", $green[0], $green[1] , 1, 0)
            
            Else if @ErrorLevel <> 0
                i++
            If (i > 10)
                MainLoop()

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

uhhgg no sir you misunderstood. the thread has far different question and different situation.. the one is counting pixel and priority pixel 

There wasn't much to misunderstand in your previous post as that clearly stated you started a new one because no one was replying...agree?
Anyways: Simply stick to a single thread and answer to the replies you are getting as that could be considered polite behavior.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

There wasn't much to misunderstand in your previous post as that clearly stated you started a new one because no one was replying...agree?
Anyways: Simply stick to a single thread and answer to the replies you are getting as that could be considered polite behavior.

Jos

Its been 11 hours and no ones replying so I just thought probably my macro is too hard and seems impossible to automate. so i decided to try another different macro instance .

thanks btw. i already edited my posts and title. i hope they didnt confuse because the replies are kinda confusing from the thread

Share this post


Link to post
Share on other sites

The forum netiquette expects users to wait at least 24 hours before bumping a thread.

BTW: What is a "priority pixel"?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

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