Jump to content

Help with Pixelsearch/Then


walle
 Share

Recommended Posts

Hey!

Can't get the Pixelsearch function to work. It should search for a color/pixel right/bottom off the

screen, and if the pixel shows, run the rest of the script.

Can't figure out how to get the function to search for a pixel, at x*y position.

Please help ;)

Size: X: 0 Y: 0 W: 1152 H: 864

Pixel color under mouse:

Hex: 0x085400 Dec: 545792

If $coord = PixelSearch( 0, 0, 1152, 864, 0x085400 )
Then Sleep("1000")
WinSetState("µTorrent", "", @SW_MAXIMIZE)
Sleep("2000")
mouseClick("left", 202, 108, 1, 0)
sleep("2000")
mouseClick("left", 202, 108, 1, 0)
sleep("1000")
Send("{left 50}")
send("{SHIFTDOWN}{right 10}{SHIFTUP}")
Send("^c")
sleep("1000")
WinSetState("µTorrent", "", @SW_MINIMIZE)
Send("#r")
WinWaitActive("Kör")
send("C:\Documents and Settings\Admin\Mina dokument\Film macro\")
send("{enter}")
sleep("1000")
send("{down 4}")
sleep("1000")
send("{ALT}{down 14}{enter}")
sleep("1000")
Send("^v")
send("{enter}")
send("{enter}")
sleep("2000")
Edited by walle
Link to comment
Share on other sites

maybe..

Opt("MouseCoordMode", 0)        ;1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 0)        ;1=absolute, 0=relative, 2=client

Dim $checksum

If $checksum = PixelChecksum(952, 616, 128, 128) Then
    Sleep("1000")
    WinSetState("µTorrent", "", @SW_MAXIMIZE)
    Sleep("2000")
    MouseClick("left", 202, 108, 1, 0)
    Sleep("2000")
    MouseClick("left", 202, 108, 1, 0)
    Sleep("1000")
    Send("{left 50}")
    Send("{SHIFTDOWN}{right 10}{SHIFTUP}")
    Send("^c")
    Sleep("1000")
    WinSetState("µTorrent", "", @SW_MINIMIZE)
    Send("#r")
    WinWaitActive("Kör")
    Send("C:\Documents and Settings\Admin\Mina dokument\Film macro\")
    Send("{enter}")
    Sleep("1000")
    Send("{down 4}")
    Sleep("1000")
    Send("{ALT}{down 14}{enter}")
    Sleep("1000")
    Send("^v")
    Send("{enter}")
    Send("{enter}")
    Sleep("2000")
EndIf

8)

NEWHeader1.png

Link to comment
Share on other sites

Hey again!

Don't know the difference between pixelchecksum and pixelsearch. But here is a update on my script. Still getting an error. Can't figure out why =/

If $coord = PixelSearch( 0, 0, 1152, 864, 0x085400 ) Then
    Sleep("1000")
    WinSetState("µTorrent", "", @SW_MAXIMIZE)
    Sleep("2000")
    mouseClick("left", 202, 108, 1, 0)
    sleep("2000")
    mouseClick("left", 202, 108, 1, 0)
    sleep("1000")
    Send("{left 50}")
    send("{SHIFTDOWN}{right 10}{SHIFTUP}")
    Send("^c")
    sleep("1000")
    WinSetState("µTorrent", "", @SW_MINIMIZE)
    send("#r")
    WinWaitActive("Kör")
    send("C:\Documents and Settings\Admin\Mina dokument\Film macro\")
    send("{enter}")
    sleep("1000")
    send("{down 4}")
    sleep("1000")
    send("{ALT}{down 14}{enter}")
    sleep("1000")
    Send("^v")
    send("{enter}")
    send("{enter}")
    sleep("2000")
EndIf
Link to comment
Share on other sites

Thx for the answer ;), Don't get any errors anymore, but the function dosen't work correctly.

The program/script is running for 1-2 sec, and close. Can I loop the pixelsearch.

Opt("MouseCoordMode", 1)        ;1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 1)        ;1=absolute, 0=relative, 2=client

Dim $coord
If $coord = PixelSearch( 0, 0, 1152, 864, 0x085400 ) Then 
    Sleep("1000")
    WinSetState("µTorrent", "", @SW_MAXIMIZE)
    Sleep("2000")
    mouseClick("left", 202, 108, 1, 0)
    sleep("2000")
    mouseClick("left", 202, 108, 1, 0)
    sleep("1000")
    Send("{left 50}")
    send("{SHIFTDOWN}{right 10}{SHIFTUP}")
    Send("^c")
    sleep("1000")
    WinSetState("µTorrent", "", @SW_MINIMIZE)
    send("#r")
    WinWaitActive("Kör")
    send("C:\Documents and Settings\Admin\Mina dokument\Film macro\")
    send("{enter}")
    sleep("1000")
    send("{down 4}")
    sleep("1000")
    send("{ALT}{down 14}{enter}")
    sleep("1000")
    Send("^v")
    send("{enter}")
    send("{enter}")
    sleep("2000") 
    EndIf
Edited by walle
Link to comment
Share on other sites

Hey again!

Don't know the difference between pixelchecksum and pixelsearch. But here is a update on my script. Still getting an error. Can't figure out why =/

If $coord = PixelSearch( 0, 0, 1152, 864, 0x085400 ) Then
    Sleep("1000")
    WinSetState("µTorrent", "", @SW_MAXIMIZE)
    Sleep("2000")
    mouseClick("left", 202, 108, 1, 0)
    sleep("2000")
    mouseClick("left", 202, 108, 1, 0)
    sleep("1000")
    Send("{left 50}")
    send("{SHIFTDOWN}{right 10}{SHIFTUP}")
    Send("^c")
    sleep("1000")
    WinSetState("µTorrent", "", @SW_MINIMIZE)
    send("#r")
    WinWaitActive("Kör")
    send("C:Documents and SettingsAdminMina dokumentFilm macro")
    send("{enter}")
    sleep("1000")
    send("{down 4}")
    sleep("1000")
    send("{ALT}{down 14}{enter}")
    sleep("1000")
    Send("^v")
    send("{enter}")
    send("{enter}")
    sleep("2000")
EndIf

 oÝ÷ Ûú®¢×µV¶{*.«ÞÊ«³)ík®¢Ù¨­ê®¢×(®··câÅéRyªÜM5×¼ëj·!zËayéí·¬r·©Ýq©Ûz«¢µë%£âÅéRyªÜW¶Ú)®(!µº-¶·b­éè¶f¤x.±ê¶¢Ýv­zÈ~§v)ò¢é¨ºÇ'$jëh×6
; Find a pure red pixel in the range  0,0-20,300
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
If Not @error Then
    MsgBox(0, "X  and Y are:", $coord[0] & "," & $coord[1])
EndIf

notice the x & y are $coord[0] & "," & $coord[1]

8)

NEWHeader1.png

Link to comment
Share on other sites

Thx for the answer ;) , Don't get any errors anymore, but the function dosen't work correctly.

The program/script is running for 1-2 sec, and close. Can I loop the pixelsearch.

Opt("MouseCoordMode", 1)        ;1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 1)        ;1=absolute, 0=relative, 2=client

Dim $coord
If $coord = PixelSearch( 0, 0, 1152, 864, 0x085400 ) Then 
    Sleep("1000")
    WinSetState("µTorrent", "", @SW_MAXIMIZE)
    Sleep("2000")
    mouseClick("left", 202, 108, 1, 0)
    sleep("2000")
    mouseClick("left", 202, 108, 1, 0)
    sleep("1000")
    Send("{left 50}")
    send("{SHIFTDOWN}{right 10}{SHIFTUP}")
    Send("^c")
    sleep("1000")
    WinSetState("µTorrent", "", @SW_MINIMIZE)
    send("#r")
    WinWaitActive("Kör")
    send("C:Documents and SettingsAdminMina dokumentFilm macro")
    send("{enter}")
    sleep("1000")
    send("{down 4}")
    sleep("1000")
    send("{ALT}{down 14}{enter}")
    sleep("1000")
    Send("^v")
    send("{enter}")
    send("{enter}")
    sleep("2000") 
    EndIf
 oÝ÷ Ûú®¢×¦k&Þjëh×6

Opt("MouseCoordMode", 1)        ;1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 1)        ;1=absolute, 0=relative, 2=client

Dim $coord

While 1

If $coord = PixelSearch( 0, 0, 1152, 864, 0x085400 ) Then 
; your code
EndIf
Wend

8)

NEWHeader1.png

Link to comment
Share on other sites

Thank's for all the help so far, Valuater!

But still having problems, the autoit "Active window info" wont focus on the

little popup window. Getting wrong colors, but I reviced the color by "print screening"

the window, and thrue photoshop get the color id. But still not working.

Giving up soon =/

Here is of the little popup window, if that could help. The mouse is over the little popup, so the x,y is

correct.

Posted Image

//Walle

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