Jump to content

Recommended Posts

Posted

I'm having trouble with the first part of my function. When my script enters the function it right clicks like needed, then i expect it to loop until the pixel in the region changes to the desired color, but instead it sleeps for a second continues onto left mouseclick at (150,150) then returns back to the top of the function. This repeats maybe 3 times before the script finally sleeps.(my guess is in the second Do Until loop because after i manually change a pixel in the $Pix2 region the script makes its final click at (50,50) goes back into the While Loop and continues like normal until $BrainisCool = True.  If i remove the first Do...Until loop with Sleep(10000) or whatever, the function continues all the way through, and doesnt break at the second one. 

If you cant understand i dont blame you, the easiest solution would be just to keep the Sleep(10000) and be done with it. 

;there is more to the while loop but this is the part that sends it into the func figured it would get me closer to a solution if i included it
Global $BrainisCool = False
While(1)
    $BrainisCool = True
        $CoolBrain = PixelSearch(0, 0,10, 10,0x0000FF,1)
            if not(@error)Then
                MeltMyBrain()
            Else
                $BrainisCool = False
            EndIf
WEnd

Func MeltMyBrain()

    MouseClick("right",200,200,1,1)
        Do
            $Pix1 = PixelSearch(0,0,25,25,0xFF0000,1)
                If (@error) then
                Sleep(1000)
                EndIf
        Until Not (@error)
    MouseClick("left",150,150,1,1)

;after this line the script does what its suppose to do.


    MouseClick("right",100,100,1,1)
        Do
            $Pix2 = PixelSearch(0,0,25,25,0x00FF00,1)
                If not (@error) Then
                Sleep(1000)
                EndIf
        Until (@error)
    MouseClick("left",50,50,1,1)
EndFunc

 

Posted

I've been here for many years and I can only count on one hand legitimate reasons why to use pixel search for something. Pretty much every other time it is the wrong thing to do in automating something. In just about every other case hooking into the control is the correct method. So, saying that If this script did what you want, WHERE would you use it? Please do NOT tell me HOW it works. I want to know WHY you want to use it. For example what windows application will the script work with. If you provide this information, %99 chance there is a better way than what you are doing and there is a script that already does what you want. 

Posted

I use it on chrome mainly to scan a file with my antivirus after its finished downloading. I used pixelsearch because it was easier to understand, and i figured i could also use it for different browsers just by changing a little bit of the script. (2nd reasoning is an excuse to make me feel better about reasoning 1). 

Posted

isn't your scanner going off automatically when downloaded like most antivirus? the build in one for Win10 auto scans downloads.

My resources are limited. You must ask the right questions

 

  • Moderators
Posted

Agree with above, what Anti-Virus are you using? Most any commercial or open source AV should give you the option (or even default to) scan on download. You should not have to run a script to do this basic AV task, and certainly shouldn't have to resort to something as untrustworthy as PixelSearch.

"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!

Posted

Im using windows defender. When i first got my computer it worked fine with microsoft edge. I got a notification in my tray and in the browser. on chrome i dont get a notification, I assumed it wasnt scanning and i've been doing the scans manually. I got a free trial for MBAM and i ran into the same problem

 

 

Posted (edited)

chrome has built in malware and phishing protection unless you set it to off

also, just write a script that monitors the download directory. when new files appear, scan them with tool of your choice.

 

here is FileSystemMonitor UDF

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted
1 hour ago, Earthshine said:

chrome has built in malware and phishing protection unless you set it to off

also, just write a script that monitors the download directory. when new files appear, scan them with tool of your choice.

 

here is FileSystemMonitor UDF

Thanks! This would remove the need to change the code around for seperate browsers, if im understanding it correctly. I tried messing with chrome but still couldnt figure it out, but im sure this will serve me just as fine, assuming i get it to work :P. Seems pretty straight forward so shouldnt be a problem

 

4 hours ago, Bert said:

I've been here for many years and I can only count on one hand legitimate reasons why to use pixel search for something. Pretty much every other time it is the wrong thing to do in automating something. In just about every other case hooking into the control is the correct method.

Can you link me to a guide about how controls work? Im fairly new to autoit, any other automation i would do has been done with a mouse recorder or keystrokes based off pixelsearches.

T

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...