Sign in to follow this  
Followers 0
j420n

...Lost In Color...

4 posts in this topic

Hey,

I was looking into making a small .au3 program that could search a browser for certain color(s) and click them , and possibly keep a log of how many times the color was found and succesfully clicked on.

So I pulled up the AutoIt helpfile, and looked at the 'Graphics and Sound Functions" and the PixelSearch and PixelGetColor, were the main ones i was looking at, and I got instantly confused, I'm not use to doin the PixelSearches etc...

So if Anybody could help Explain what I should do to go about makin the .au3 with what I'm looking into makin. It would be a Big Help B)

--peace--

J420N

Share this post


Link to post
Share on other sites



I've messed with them a bit and I'd be happy to try and help you.

However first off you should be aware that they can be very processor intensive, and depending on how you use them, they can be pretty slow especially if you are trying to search over a large area.

Can you give me more info about what you are trying to do?


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Not the fastest thing in the world (PixelSearch) for Big areas, so if you know around where it would be, you could do a couple of them.

Here is a working example:

Opt ("WINTITLEMATCHMODE", 4)
Opt("PIXELCOORDMODE", 0); 0 FOR WINDOW COORDS 1 IS SCREEN, 2 IS CLIENT
Opt("MOUSECOORDMODE", 0); SAME AS ABOVE


While 1
    If Not WinActive("window name") Then WinActivate("window name")
;PIXELSEARCH() - SHOULD BE X (example 100), Y (example 200) (FOR STARTING POINT) THEN, X (example 800), Y (example 900) FOR ENDING POINT
    $PixSearch = PixelSearch(100, 200, 800, 900, 0xFF0000); SHOULD BE SAME AS PIXELGETCOLOR() BUT WITH COORDS DISPLAYED) ALSO
    If Not @error Then
        MouseClick("LEFT", $PixSearch[0], $PixSearch[1], 1, 1)
    EndIf
    Sleep(100)
WEnd

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

here is a way to find what color you are looking for

it gives the results and copies it to the clipboard..

all you have to do is paste it in the pixel search

;*********** Use **************
; Press Esc to terminate script
; Press F8 to open a color dialog box and choose a color
; Or
; Press F9 to get the color under the mouse pointer
; by Valuater...... Enjoy!!!  
;******************************
#include <GuiConstants.au3>
#include <Misc.au3>
Global $var, $Color_win
HotKeySet("{F8}", "Color_Box")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "Get_Color") 

ToolTip('Get Color - is Running',0,0)
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func Color_Box()
    $var = _ChooseColor (2)
    Show_Color()
EndFunc
Func Terminate()
    Exit 0
EndFunc
Func Get_Color()
    $pos = MouseGetPos()
    $Svar = PixelGetColor(  $pos[0] , $pos[1])
    $var = "0x" & Hex($Svar,6)
    Show_Color()
EndFunc
Func Show_Color()
    GUIDelete($Color_win)
    ClipPut($var)
    $Color_win = GUICreate("RGB Color = " & $var, 290, 150, -1, -1)
    GUISetBkColor($var)
    GUISetFont(9, 400, -1, "MS Sans Serif")
    GUICtrlCreateLabel(" This Color has been Copied to the ClipBoard  " & @CRLF & @CRLF & "  Just Paste it wherever you would like", 10, 10, 270, 100)
    GUICtrlSetFont(-1, 9, 650)
    If $var = 0x000000 Then GUICtrlSetColor( -1, 0xFFFFFF) 
    $OK_Btn = GUICtrlCreateButton("&OK", 100, 110, 80, 30)
    GUISetState()
    While 2
        $msg1 = GUIGetMsg()
        If $msg1 = $OK_Btn Or $msg1 = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete($Color_win)   
EndFunc

8)


NEWHeader1.png

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