Sign in to follow this  
Followers 0
crazycrash

pixelsearch in the middle of the screen, dont know whats wrong

3 posts in this topic

Basically i am trying to find out if there is a certain colour within a 10pixel square in the middle of the screen/window. Somehow my script doesnt seem to work though, i am checking if scite is white in the middle, which it has to be, but i dont get the msg box. So i somehow made a mistake. By the way, would this also work, well once its working, for a fullscreengame, so it would then just find the middle of the screen?

Thanks a lot for the help.

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d
$size = WinGetPos("SciTE") 
If @error = 1 Then
    MsgBox (0, "damn", "couldnt find window")
    EndIf
$xmid = $size[0] + $size[2]/2
$ymid = $size[1] + $size[3]/2

;;;; Body of program would go here;;;;
While 1
    Sleep(2000)
    $red = PixelSearch( $xmid-5, $ymid+5, $xmid+5, $ymid-5, 0xFFFFFF)
    If IsArray($white) = 1 Then
    MsgBox(0, "color", "there was white found in the middle of the screen", 1)
    EndIf
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip('Script is "Running"',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc

Share this post


Link to post
Share on other sites



I tried something else after reading through quite a few scripts, but still it wont find the white on a maximized white ie explorer page...

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d

$xmid = @DesktopWidth/2
$ymid = @DesktopHeight/2
$lookingfor = 0xFFFFFF

;;;; Body of program would go here;;;;
While 1
    MsgBox(0, "x", $xmid)
    MsgBox(0, "y", $ymid)
    Sleep(2000)
    $go = PixelSearch( $xmid-5, $ymid+5, $xmid+5, $ymid-5, $lookingfor)
    If IsArray($go) Then
    MsgBox(0, "color", "there was white found in the middle of the screen")
    EndIf
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip('Script is "Running"',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc

Share this post


Link to post
Share on other sites

Problem found, was my square box lol, correct would be

$go = PixelSearch( $xmid-5, $ymid-5, $xmid+5, $ymid+5, $lookingfor)

Thanks =D

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