Jump to content
Sign in to follow this  
oiTommy

About Setting mouse possition

Recommended Posts

oiTommy

Hello autoit community, started using this program, and it's amazing!

So, I want to ask some help from you :)

My screen resolution is 1440x900, and I want to

width= 717

heigh= 427

If in this mouse possition color is for example ff0000, to push Y letter, is that possible to make it?

p.s. sorry for bad english :/ I hope you understand, what i have written there:)

Edited by oiTommy

Share this post


Link to post
Share on other sites
oiTommy

While True

$color = PixelGetColor(714, 452)

If $color = 16777215 Then

Send("{y 10}")

EndIf

WEnd

i tryed to do something like that, but doesn't work properly o.o

*if in 714, 452 color is white, push g 10times

Edited by oiTommy

Share this post


Link to post
Share on other sites
oiTommy

ok, then next question about this line-

$color = PixelGetColor(717, 427)

how to do pixelgetcolor between 700, 400 to 720, 430 that every pixel inside would be checkt?

Share this post


Link to post
Share on other sites
Centrally

ok, then next question about this line-

$color = PixelGetColor(717, 427)

how to do pixelgetcolor between 700, 400 to 720, 430 that every pixel inside would be checkt?

$color = PixelSearch(700, 400, 720, 430, colorYouWant)

Share this post


Link to post
Share on other sites
oiTommy

so

While True

$color = PixelSearch(700, 400, 720, 430, 16777215, 16711680, 16646144)

If $color = 16777215 Or $color = 16711680 Or $color = 16646144 Then

Send("{g 10}")

EndIf

WEnd

If i do this one, it will search between 700, 400 to 720, 430 for those colors, and if finds, pushes G letter?

messt up... :(

Edited by oiTommy

Share this post


Link to post
Share on other sites
Centrally

so

While True

$color = PixelSearch(700, 400, 720, 430, 16777215, 16711680, 16646144)

If $color = 16777215 Or $color = 16711680 Or $color = 16646144 Then

Send("{g 10}")

EndIf

WEnd

If i do this one, it will search between 700, 400 to 720, 430 for those colors, and if finds, pushes G letter?

messt up... :(

I'm afraid that you wont be able to search for 3 different colors in single pixelsearch function (or am I wrong?)

I guess you would want something like this instead:

Func searchForPixel()
local $i = 0
While $i <= 10
Local $color = PixelSearch(700, 400, 720, 430, 16777215)
If Not @error Then
Send("g")
Else
$color = PixelSearch(700, 400, 720, 430, 16711680)
If Not @error Then
Send("g")
Else
$color = PixelSearch(700, 400, 720, 430, 16646144)
If Not @error Then
Send("g")
EndIf
EndIf
EndIf
$i = $i + 1
Sleep(1000)
WEnd
EndFunc

Note that this my be hacky solution since I'm quite new to AutoIt.

Edited by Centrally

Share this post


Link to post
Share on other sites
oiTommy

You see, I need that from 700, 400 to 720, 420 all pixels between theese would be checked, and if there would be any of these 3 colors-

16777215, 16711680, 16646144 , autoit would press g letter

Share this post


Link to post
Share on other sites
JohnOne

You will need to loop through each pixel and test it for the three colours.

Here is a micro example.

For $y = ... To ...
    For $x = ... To ...
        If _IsColour($x,$y) Then
            ...
        EndIf   
    Next    
Next    

Func _IsColour($x,$y)
    If PixelGetColor($x,$y) = 16777215 Then Return 1
    If PixelGetColor($x,$y) = 16711680 Then Return 1
    If PixelGetColor($x,$y) = 16646144 Then Return 1
    Return 0
EndFunc

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
oiTommy

Thanks guys, tryed easier way for making it

While True

$color = PixelSearch(700, 430, 740, 470, 16777215)

If Not @error Then

Send("g")

endif

$color = PixelSearch(700, 400, 720, 430, 16711680)

If Not @error Then

Send("g")

endif

$color = PixelSearch(700, 400, 720, 430, 16646144)

If Not @error Then

Send("g")

EndIf

WEnd

Thanks enough for me :) thank you everyone

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  

×