Jump to content
Sign in to follow this  
Dag

mouse move: spiral function

Recommended Posts

Dag

Posted Image

someone can help me with spiral mouse move (like on screen, move from center)

on forum i found this http://www.autoitscript.com/forum/index.php?showtopic=21440 but i have no idea how to use it or is it good for me.

ps. sorry for my picture, i made this in paint using my crapy mouse

Edited by Dag

Share this post


Link to post
Share on other sites
Blue_Drache

Ouch. That's a fun math problem. If you can find a formula via google, you can translate it into x,y coordinates. Good luck.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
Dag

Posted Image

Posted Image

Posted Image

Posted Image

i found this

(hope images are not too big)

Edited by Dag

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

HotKeySet("{ESC}", "quitme")
HotKeySet("1", "MouseSearch")
HotKeySet("2", "_stop")
AdlibEnable("check", 10)
Global Const $PI = 3.1415926535897932384626433832795
Global $Width = @DesktopWidth, $Height = @DesktopHeight, $MidX = $Width / 2, $MidY = $Height / 2
Global $Radius = 5
Global $Step = $PI / 6
Global $stop = 1
Global $coord = ""
ToolTip("Mouse Mover!!", $MidX, $MidY)
MouseSearch()
Func MouseSearch()
    While 1
        Do
            For $angle = 0 To 2 * $PI Step $Step
                $Radius += 5
                MouseMove($MidX - (Cos($angle) * $Radius), $MidY - (Sin($angle) * $Radius), 0)
            Next
        Until $Radius >= $MidY
        Do
            For $angle = 0 To 2 * $PI Step $Step
                $Radius -= 5
                MouseMove($MidX - (Cos($angle) * $Radius), $MidY - (Sin($angle) * $Radius), 0)
            Next
        Until $Radius <= 5
        If $stop <> 1 Then ExitLoop
        WEnd
EndFunc   ;==>MouseSearch

Func check()
    $xy = MouseGetPos()
    Global $coord = PixelSearch($xy[0] - 50, $xy[1] - 50, $xy[0] + 50, $xy[1] + 50, 0xFFFF4C)
    If @error <> 1 Then
        _stop()
        MouseClick("left", $coord[0], $coord[1], 1)
    EndIf
EndFunc   ;==>check

Func quitme()
    Exit
EndFunc   ;==>quitme

Func _stop()
    $stop = 0
    While 1
        Sleep(100)
    WEnd
EndFunc   ;==>_stop

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Dag

you are amazing

thanks!!

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

good luck with the piece of code.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
prancingpony

 I enjoyed thinking about this problem so I worked up a functioning blueprint here.

Run it and you will see that it sends you the coordinates of a spiral starting at the origin and going up and left but only touching lattice points (whole number intersections). I understand that there are plenty of "rational" expressions for spiral functions but I didn't find a code for the lattice spiral function. All someone would have to do from here is transfer the information in the msgbox's into their pixelsearch routine where their current mouse position is the origin. Hope this might help someone. Its not terribly complicated but it did require a couple hours of thought.

#include <Misc.au3>
$hDLL = DllOpen("user32.dll")
HotKeySet("{ESC}", "_exit")
Func _exit()
    Exit
EndFunc

$i=0
$j=0
$x=0
$z=0
$m=0
$a=0
$n=0
$b=0
$counter1=0
$counter2=0
$counter3=0
$counter4=0

while 1



Do

    $i=0
        Do
            $i+=1
            msgbox(0,"",-($n-$b)&","&$x+$i)


        until abs($x+$i)>abs($z-$j)

$z=$x+$i

$counter1+=1

until $counter1>$counter2
;_____________________________________________________
Do

$a=0
        Do
            $a+=1
            msgbox(0,"",-($m+$a)&","&$x+$i)


        until abs($m+$a)>abs($n-$b)

$n=$m+$a

$counter2+=1

until $counter2=$counter1
;_____________________________________________________

Do
    $j=0
        Do
            $j+=1
            msgbox(0,"",-($m+$a)&","&$z-$j)

        until abs($z-$j)>=abs($x+$i)

$x=$z-$j

$counter3+=1

until $counter3>$counter4
;___________________________________________________

Do
$b=0
        Do
            $b+=1
            msgbox(0,"",-($n-$b)&","&$z-$j)

        until abs($n-$b)>=abs($m+$a)

$m=$n-$b

$counter4+=1

until $counter4=$counter3

;___________________________________________________

WEnd

I separated the "4 steps" with the lines to help indicate that these are each "sides" of the spiral we are traveling along in our search.

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  

×