GUI soll ausweichen

  • Hallo,

    ich habe einen Script geschrieben:

    Spoiler anzeigen
    [autoit]

    $x = 200
    $y = 200

    [/autoit] [autoit][/autoit] [autoit]

    $hwnd = GUICreate("Fang mich", $x, $y)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $Pos = GUIGetCursorInfo($hwnd)
    If $Pos[0] < $x And $Pos[0] > 0 And $Pos[1] < $y And $Pos[1] > 0 Then
    While 1
    $Pos = GUIGetCursorInfo($hwnd)
    If $Pos[0] < $x And $Pos[0] > 0 And $Pos[1] < $y And $Pos[1] > 0 Then
    WinMove($hwnd, "", Random(0, @DesktopWidth, 1) - $x - 20, Random(0, @DesktopHeight, 1) - $y - 20)
    Else
    ExitLoop
    EndIf
    WEnd
    EndIf
    Sleep(10)
    WEnd

    [/autoit]

    Dabei soll eine GUI immer ausweichen, wenn der Mauszeiger über ihm ist. Nun das hab ich geschafft, abber wie kann man sowas wie ein Beschleunigungs und Brems effekt einbauen. Die GUI soll nicht sofort an einem anderen Fleck sein, sondern erst langsam dann schneller und kurz vor dem Ziel abbremsen.

  • Ist doch bei Winmove im Parameter dabei?

    Spoiler anzeigen
    [autoit]

    $x = 200
    $y = 200

    [/autoit] [autoit][/autoit] [autoit]

    $hwnd = GUICreate("Fang mich", $x, $y)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $Pos = GUIGetCursorInfo($hwnd)
    If $Pos[0] < $x And $Pos[0] > 0 And $Pos[1] < $y And $Pos[1] > 0 Then
    While 1
    $Pos = GUIGetCursorInfo($hwnd)
    If $Pos[0] < $x And $Pos[0] > 0 And $Pos[1] < $y And $Pos[1] > 0 Then
    WinMove($hwnd, "", Random(0, @DesktopWidth, 1) - $x - 20, Random(0, @DesktopHeight, 1) - $y - 20, Default, Default, 3 )
    Else
    ExitLoop
    EndIf
    WEnd
    EndIf
    Sleep(10)
    WEnd

    [/autoit]
  • WinMove ( "title", "text", x, y [, width [, height[, speed]]] )
    Sollte doch nicht so schwer sein, du hast ja sogar nen Parameter dafür o.o