Jump to content

Newbie help


asan
 Share

Recommended Posts

ok I know almost nothing about coding, i know of html and a little php, Im in need of a simple type of program at least I think its simple.

I will have about 12 browser windows opened (see pic) now there will be a snow flake that will be floating by in the corners, is there a way i could make something that would click it every time a snowflake went by. The snowflakes fall about 1 every 5-10 minutes, I also uploaded a pic of what the snow flake will look like.

Posted Image

Posted Image

thanks so much in advanced,

hoping someone can help me out =(

Edited by asan
Link to comment
Share on other sites

Does this picture pass through any specific coordinates on your desktop?

If so, you could use PixelChecksum or PixelGetColor to look for a change in color to the desktop (i.e when the snowflake floats by). Restrictions being that the snowflake must pass over a viewable area of the screen, and not behind the twelve firefox windows. When a change is detected, then you do a MouseClick on those coordinates.

Link to comment
Share on other sites

Does this picture pass through any specific coordinates on your desktop?

If so, you could use PixelChecksum or PixelGetColor to look for a change in color to the desktop (i.e when the snowflake floats by). Restrictions being that the snowflake must pass over a viewable area of the screen, and not behind the twelve firefox windows. When a change is detected, then you do a MouseClick on those coordinates.

something like that, if you take a look at the pic of the browser you can see there is a small space where you can see each browser. Now the snowflake will pass every 5-10 minutes in different locations. Im not sure what you mentioned about it being viewable, you can see it but it goes by so quick, but the space is small, so its not fully viewable

Link to comment
Share on other sites

after searching i found and edited this

Func Search()
    $boolean = 0
    While $boolean = 0
        $Coords = PixelSearch(764, 191, 783, 443, 0xE4C9E4, 10) <-what all those #'s764,191,783
        Sleep(2000)
        $boolean = IsArray($Coords)
    WEnd
    MouseClick("Left", $Coords[0], $Coords[1], 1, 1)
EndFunc

now i dont know what cords do or any of that does lol

but it something like i looking for, I have other colors i want to put into the pixelsearch, if you look at my first post the snowflake has many diffrent colors like 0xC4A69E or 0xE5CCC5 there are plenty more, can someone help me out on this, I need it so when those colors go floating by this script will left click on it and continue to search my desktop for these colors as they appear.

Edited by asan
Link to comment
Share on other sites

here is what i have so far

the area

[SearchArea]
Left=11
Top=78
Right=539
Bottom=779
[Main]
PixelColor=10923724
PixelCheckSum=1287665894

I also clicked on the snowflake to get a few more colors here are those results

[Main]
PixelColor=16579836
PixelCheckSum=919870644

[Main]
PixelColor=12569591
PixelCheckSum=4250352666

[Main]
PixelColor=15330549
PixelCheckSum=399654503

[Main]
PixelColor=9805507
PixelCheckSum=1196896847

now im lost lol

now what i need is for it to find those colors in that area, and after it clicks it, i need it to keep on searching for more of the same colors, I can add more colors if this helps. the snowflakes go by pretty quick and the area is small, so if there any type of timers it would need to be quick, also an exit button or esc would do to shut it down, can someone please help the newbiew out i need this soon

thanks again

Link to comment
Share on other sites

Instead of finding the color of the snow flake you could just see if the color in that area changes. Is the flake a program of yours? if so you could just pull where the flake is at from there. and when its in a specified spot have it click.

no the flake is not a program of mine, i dont know how to use autoit that much yet im trying to learn,

I guess you cold do what you said, instead of finding the color of the flake we could see if the area changes color, that sounds fine to, only thing is im a big newbie and am lost, ive been trying to read up as much as i can but i dont think ill be able to get what i want in 2-3 days

thanks for the help.

Link to comment
Share on other sites

#Include <Misc.au3>
#Include <WindowsConstants.au3> 



HotKeySet("1","_RecordChecksum")
HotKeySet("2","_RecordArea")
HotKeySet("3","_LoopFind")
HotKeySet('{esc}', '_Exit')

Global $FileName = "SearchData.ini"
Global $xy,$currentpixel
Global $msg =   "Press 1 to Record Checksum" & @LF & _
                "Press 2 to Record TotalSearchArea" & @LF & _
                "Press 3 to Find " & @LF & _
                "info saved in "&$FileName 

While 1
    $xy = MouseGetPos()
    $currentpixel = PixelGetColor($xy[0],$xy[1])
    ToolTip("Pixel color = " & $currentpixel & @LF & $msg)
    Sleep(100)
WEnd

Func _LoopFind()
    While 1
        _Find()
    Wend
EndFunc

Func _RecordChecksum()
    IniWrite($FileName,"Main","PixelColor",$currentpixel)
    Local $chksum = PixelChecksum($xy[0]-2, $xy[1]-2, $xy[0]+2, $xy[1]+2)
    IniWrite($FileName,"Main","PixelCheckSum",$chksum)
    ToolTip('          '&@CRLF&'  Pixel Checksum Recorded  '&@CRLF&'          ')
    Sleep(2000)
EndFunc

Func _RecordArea()
    ToolTip("Left Click at Top-Left Corner of Total Search Area, then at Bottom-Right")
    $position = _DrawRect_Drag("01")
    IniWrite($FileName,"SearchArea","Left",$position[0])
    IniWrite($FileName,"SearchArea","Top",$position[1])
    IniWrite($FileName,"SearchArea","Right",$position[2])
    IniWrite($FileName,"SearchArea","Bottom",$position[3])
    ToolTip('          '&@CRLF&'  Total Search Area Recorded.  '&@CRLF&'          ')
    Sleep(2000) 
EndFunc 

Func _Find()
    Local $pixel =  Int(IniRead($FileName,"Main","PixelColor","-1"))
    Local $chksum = Int(IniRead($FileName,"Main","PixelCheckSum","-1"))
    Local $Left = IniRead($FileName,"SearchArea","Left","0")
    Local $Top = IniRead($FileName,"SearchArea","Top","0")  
    Local $Right = IniRead($FileName,"SearchArea","Right",@DesktopWidth)
    Local $Bottom = IniRead($FileName,"SearchArea","Bottom",@DesktopHeight)
    
    $sv = 0
    $w = 1
    $x = $Left ;LEFT pixel of Total Area to Search for $pixel
    $y = $Top ;TOP 
    $xpixel = $Right ;Right
    $ypixel = $Bottom ;Bottom
    
    While $w = 1
        $xy = PixelSearch($x,$y,$xpixel,$ypixel,$pixel, $sv)
        If $w = 3 Then 
            Exit
        EndIf

        If @error And $ypixel = $Bottom Then
            ;ToolTip('          '&@CRLF&"    Could not find Checksum"&@CRLF&'   Finished Searching all of Screen   '&@CRLF&'          ')
            ;Sleep(3000)    
            SetError(1)
            Return 0
        ElseIf @error Then
            $y = $ypixel + 1
            $ypixel = $Bottom
            $x = 0
        ElseIf $chksum = PixelCheckSum($xy[0]-2, $xy[1]-2, $xy[0]+2, $xy[1]+2) Then 
            $w = 3          ;PixelCheckSum(left, top, right, bottom [, step] )
            MouseMove($xy[0],$xy[1], 0)
            ToolTip("Found Checksum")
                $pos = MouseGetPos()
                MouseClick("Left",$pos[0], $pos[1])
        Else
            $y = $xy[1]
            $ypixel = $y
            $x = $xy[0] + 1
        EndIf
    WEnd
EndFunc

Func _Exit()
    ToolTip('          '&@CRLF&'  EXITING  '&@CRLF&'          ')
    Sleep(500)
    Exit
EndFunc 

;=================================   _DrawRect_Drag   ============================
; Function Name:    _DrawRect_Drag
; Requires:         <WindowsConstants.au3> & <Misc.au3>
; Description:      Gives a visual aid while defineing Top\Left|bottom\Right of a given area
; Parameters:       $ActionKey      Hex code for key to press to begin and end render
;                   $color          Color of the display box
; Syntax:            _DrawRect_Drag([$ActionKey][,$color])
; Author(s):        ofLight
; Returns:          $array[4]      $array[0] = Left, $array[1] = Top, $array[2] = Right, $array[3] = Bottom
;===============================================================================
Func _DrawRect_Drag($ActionKey = "2D", $color = 0xFF0000)

    Do
        $pos = MouseGetPos()
        Sleep(25)
    Until _IsPressed($ActionKey)
    
    Local $ScanWidth = 1, $ScanHeight = 1
    Local $positions[4]
    $positions[0] = $pos[0] ;LEFT
    $positions[1] = $pos[1] ;TOP
    $x = $pos[0]
    $y = $pos[1]
    
    $GUI_DR = GUICreate("", 0, 0, $x, $y, $WS_POPUP)
    WinSetTrans($GUI_DR,"",210)
    $Top_DR = GUICreate("Top Line", $ScanWidth, 2, $x, $y, $WS_POPUP, -1, $GUI_DR)
    GUISetBkColor($color)
    WinSetTrans($Top_DR,"",210)
    GUISetState()
    $Left_DR = GUICreate("Left Line", 2, $ScanHeight, $x, $y, $WS_POPUP, -1, $GUI_DR)
    GUISetBkColor($color)
    WinSetTrans($Left_DR,"",210)
    GUISetState()
    $Right_DR = GUICreate("Right Line", 2, $ScanHeight, $x + $ScanWidth - 2, $y, $WS_POPUP, -1, $GUI_DR)
    GUISetBkColor($color)
    WinSetTrans($Right_DR,"",210)
    GUISetState()
    $Bottom_DR = GUICreate("Bottom Line", $ScanWidth, 2, $x, $y + $ScanHeight, $WS_POPUP, -1, $GUI_DR)
    GUISetBkColor($color)
    WinSetTrans($Bottom_DR,"",210)
    GUISetState()
    Sleep(800)
    
    Do
        $MousePos = MouseGetPos()
        WinMove($Top_DR, "", $x, $y, $ScanWidth, 2)
        WinMove($Left_DR, "", $x, $y, 2, $ScanHeight) 
        WinMove($Right_DR, "", $x + $ScanWidth - 2, $y, 2, $ScanHeight)  
        WinMove($Bottom_DR, "", $x, $y + $ScanHeight, $ScanWidth, 2)
        If Not (($MousePos[0] - $x) <= 0) Then
            $ScanWidth = $MousePos[0] - $x + 1
        EndIf
        If Not (($MousePos[1] - $y) <= 0) Then
            $ScanHeight = $MousePos[1] - $y - 1
        EndIf
    Until _IsPressed($ActionKey)
    
    $positions[2] = $MousePos[0] ;RIGHT
    $positions[3] = $MousePos[1] ;BOTTOM
    
    GUISetState(@SW_HIDE,$GUI_DR)
    GUISetState(@SW_HIDE,$Top_DR)
    GUISetState(@SW_HIDE,$Left_DR)
    GUISetState(@SW_HIDE,$Right_DR)
    GUISetState(@SW_HIDE,$Bottom_DR)

    Return $positions
EndFunc;==========================   _DrawRect_Drag   ============================

EDIT: Removed the Delay if it cant find the checksum.

Edited by ofLight

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

Don't give up, throw up the code that you have so far, and I'll see if I can fill in some blanks.

hehe only thing i could come up with after searching and searching is this

HotKeySet('{esc}', '_Exit')

$coord = PixelSearch( 11, 78, 539, 779, 0xE4C9E4 )
$coord1 = PixelSearch( 11, 78, 539, 779, 0xC4A69E )
$coord2 = PixelSearch( 11, 78, 539, 779, 0xE5CCC5 )Then
MouseClick("left")
If Not @error Then
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf

now i tried finding where i can add more colors, not sure if thats how you do it. also do i need to add anything so that it would keep searching?

thanks

Alright, and where is it not doing what you want?

that was not me who posted that. Edited by asan
Link to comment
Share on other sites

that was not me who posted that.

Yea... I was running out the door, and didn't notice till today :)

Edit: Try this

HotKeySet('{esc}', '_Exit')

While 1 
$coord = PixelSearch( 11, 78, 539, 779, 0xE4C9E4 )
$coord1 = PixelSearch( 11, 78, 539, 779, 0xC4A69E )
$coord2 = PixelSearch( 11, 78, 539, 779, 0xE5CCC5 )
If Not @error Then
MouseClick("left")
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf
WEnd
Func _exit()
    Exit
EndFunc
Edited by youknowwho4eva

Giggity

Link to comment
Share on other sites

Yea... I was running out the door, and didn't notice till today :)

Edit: Try this

HotKeySet('{esc}', '_Exit')

While 1 
$coord = PixelSearch( 11, 78, 539, 779, 0xE4C9E4 )
$coord1 = PixelSearch( 11, 78, 539, 779, 0xC4A69E )
$coord2 = PixelSearch( 11, 78, 539, 779, 0xE5CCC5 )
If Not @error Then
MouseClick("left")
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf
WEnd
Func _exit()
    Exit
EndFunc

wow i almost had it =) not bad for someone who knows nothing about this. Im happy =)

Thanks for the help, i'll let you know if its working in 2 days, thats when i will need it.

also will this keep searching even if it clicks the one pixel color, until i hit the esc button? I really need it to do that. I read the help but couldnt understand it.

again thanks or ironing out my wrinkles =)

this will help me a ton.

Link to comment
Share on other sites

Yea... I was running out the door, and didn't notice till today :)

Edit: Try this

HotKeySet('{esc}', '_Exit')

While 1 
$coord = PixelSearch( 11, 78, 539, 779, 0xE4C9E4 )
$coord1 = PixelSearch( 11, 78, 539, 779, 0xC4A69E )
$coord2 = PixelSearch( 11, 78, 539, 779, 0xE5CCC5 )
If Not @error Then
MouseClick("left")
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf
WEnd
Func _exit()
    Exit
EndFunc

wow i almost had it =) not bad for someone who knows nothing about this. Im happy =)

Thanks for the help, i'll let you know if its working in 2 days, thats when i will need it.

also will this keep searching even if it clicks the one pixel color, until i hit the esc button? I really need it to do that. I read the help but couldnt understand it.

again thanks or ironing out my wrinkles =)

this will help me a ton.

I think i can bump this it's been over 24 hours =)

Edited by asan
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...