Jump to content

is it posible to stop function in the middle in case of..?


Recommended Posts

is it posible to make function what move my mouse from left side of screen to right (this in loop) and when pixel search event return succes (for example pop up show in right down corner) stop mouse moving and start next function?

i try Do function but it dont work to good in this case

and next question about sending data

i have one program writing in delphi, and i save all result in txt file, and my autoit program read this txt file and depend of saved data, start diferent functions. is it good solution? if not how to send data directly to autoit program?

thanks for helm

regards

Edited by Dag
Link to comment
Share on other sites

$color=color code
Func test()
Do
$search = PixelSearch( 345, 45, 356, 56, $color)
 If not @error Then
$pixelfound=1
EndIf
MouseMove(210, 95,2)
MouseMove(920, 95,2)
MouseMove(80,646,2)
MouseMove(962,646,2)
Until $pixelfound=1
TrayTip("", "i found pixel" , 8 , 1)
call ("other_function")
EndFunc

it is something like that, but this function first move my mouse 4 times and next call "other_function"

i need to stop mouse in the middle of move when pixel is detected

Link to comment
Share on other sites

You don't give a valid value to $color, nothing calls your test() function, and the area searched is not the same area that the mouse is moving though. What are you trying to do? I can't tell what you are trying to accomplish.

Do you want the mouse to end up on the matching pixel? This will do it, but I can't tell if that is what you are doing:

$color = 0xFFFFFF ; black

test()

Func test()
    $pixelfound = 0
    $search = PixelSearch(345, 45, 356, 56, $color)
    If Not @error Then
        MouseMove($search[0], $search[1])
        TrayTip("", "i found pixel", 8, 1)
        Sleep(2000)
    EndIf
EndFunc   ;==>test

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

area searched is not the same area that the mouse is moving though.

ya, i know

i try to explain it clearlier

my mouse is moving around all screen, and when mouse pointer is at specific object, in small area of my screen corner color change to blue

so i set pixelsearch function area in this screen fragment. and now when mouse is at specific object, my program detect color changes in screen corner, stop mouse moving and call another function.

i also know that in my previous post was no color code and function what call test() but my script have ~2,5k lines so i post only my test fragment

i hope you understand my english

thx for help

--------

edit:

my only idea is move mouse by few pixels, next check color and again move mouse, check color etc etc.

Edited by Dag
Link to comment
Share on other sites

my mouse is moving around all screen, and when mouse pointer is at specific object, in small area of my screen corner color change to blue

so i set pixelsearch function area in this screen fragment. and now when mouse is at specific object, my program detect color changes in screen corner, stop mouse moving and call another function.

OK. I think I get it.

You don't want to tell MouseMove() to go all the way across the screen then. You want your loop to increment counters for X and Y, and move one or two (or three, whatever granularity you need) pixels at a time. That will make it easy to stop when you get your color change.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...