Jump to content

About Setting mouse possition


oiTommy
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

That is a statement. Is there still a question about all the stuff posted for you to play with?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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...