Jump to content

pixelsearch priority


 Share

Recommended Posts

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
Link to comment
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

 

 

 

Link to comment
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

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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()
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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