Jump to content

Help move mouse in circle?


Recommended Posts

can anyone helpo make my mouse move in a small circle ,like really small

Hi,

have a look at MouseGetPos and MouseMove and build a loop around it. That should do the trick.

Or search the Scripts & Scraps Forum, there are a few scripts moving the mouse in some specific ways.

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

Link to comment
Share on other sites

HotKeySet ("{ESC}", "quitme")
; command line param: beep (0 = off, 1 = on)
Global $MakeNoise = 0
If $CmdLine[0] = 0 Then
    $MakeNoise = 0
ElseIf $CmdLine[1] = 1 Then
    $MakeNoise = 1
EndIf

Global Const $PI = 3.1415926535897932384626433832795
Global $Width = @DesktopWidth, $Height = @DesktopHeight, $MidX = $Width/2, $MidY = $Height/2
Global $Radius = 5
Global $Step = $PI/6
ToolTip ("Mouse Mover!!", $MidX, $MidY)
While 1
    Do
        For $angle = 0 To 2*$PI Step $Step
            $Radius += 5
            MouseMove ($MidX - (Cos ($angle) * $Radius), $MidY - (Sin ($angle) * $Radius), 0)
            If $MakeNoise = 1 Then
                Beep ($Radius*5, 2)
            EndIf
        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)
            If $MakeNoise = 1 Then
                Beep ($Radius*5, 2)
            EndIf
        Next
    Until $Radius <= 5
WEnd

Func quitme()
    Exit
EndFunc

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

Link to comment
Share on other sites

Sorry but iam not good with math but how can i just keep it from expanding and just keep it in one size?

#include <GUIConstants.au3>
#include <Math.au3>

HotKeySet ("{ESC}", "quitme")

$Stp = 10;     Defines the smoothness of the circle and mouse speed
While 1
$X = 400 ;X co-ord for center of circle
$Y = 400 ;Y co-ord  "    "     "   "
$Size = 10 ;Size of Circle

        For $R = 360 to 0 step -$Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $X
            $Y= Cos($Rad)*$Size + $Y
        MouseMove($X,$Y,1) 
        Next
WEnd

Func quitme()
    Exit
EndFunc

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

thanks thats one step close now i just have to make it were ever my mouse is

well i got this

#include <GUIConstants.au3>
#include <Math.au3>
$Stp = 20;   Defines the smoothness of the circle and mouse speed
$Size = 1;Size of Circle
HotKeySet ("{ESC}", "quitme")
HotKeySet ("{SPACE}", "On")
while 1
sleep(10)
WEnd

func On()
While 1
$pos = MouseGetPos()
$X = $pos[0];X co-ord for center of circle
$Y = $pos[1];Y co-ord 
        For $R = 360 to 0 step -$Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $X
            $Y= Cos($Rad)*$Size + $Y
        MouseMove($X,$Y,1)
        Next
    WEnd
    EndFunc

Func quitme()
    Exit
EndFunc

it doesnt work very good plus it moves tothe left? any help

Edited by X-sploiT
Link to comment
Share on other sites

try this, which is a correction to Lakes' code

#include <GUIConstants.au3>
#include <Math.au3>
$Stp = 5;    Defines the smoothness of the circle and mouse speed
$Size = 20;Size of Circle
HotKeySet ("{ESC}", "quitme")
HotKeySet ("{SPACE}", "On")
While 1
Sleep(10)
WEnd

Func On()

$Pos = MouseGetPos()
$X = $Pos[0];X co-ord for center of circle
$Y = $Pos[1];Y co-ord
While 1             ;this line was moved from before $X=..
        For $R = 360 to 0 step -$Stp
            $Rad = _Radian ($R)
; next 3 lines are corrected
            $XX = Sin($Rad)*$Size + $X
            $YY= Cos($Rad)*$Size + $Y
            MouseMove($XX,$YY,1)

;add delay so the circle is not drawn too fast to see
               Sleep(20)

        Next
    WEnd
    EndFunc

Func quitme()
    Exit
EndFunc
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

try this, which is a correction to Lakes' code

#include <GUIConstants.au3>
#include <Math.au3>
$Stp = 5;    Defines the smoothness of the circle and mouse speed
$Size = 20;Size of Circle
HotKeySet ("{ESC}", "quitme")
HotKeySet ("{SPACE}", "On")
While 1
Sleep(10)
WEnd

Func On()

$Pos = MouseGetPos()
$X = $Pos[0];X co-ord for center of circle
$Y = $Pos[1];Y co-ord
While 1         ;this line was moved from before $X=..
        For $R = 360 to 0 step -$Stp
            $Rad = _Radian ($R)
; next 3 lines are corrected
            $XX = Sin($Rad)*$Size + $X
            $YY= Cos($Rad)*$Size + $Y
            MouseMove($XX,$YY,1)

;add delay so the circle is not drawn too fast to see
               Sleep(20)

        Next
    WEnd
    EndFunc

Func quitme()
    Exit
EndFunc
I dashed it off in about 10mins or so, did`nt notice that the X and Y variables were in the loop... :whistle:

You can also control the speed with the $Stp variable. :)

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

There supposed to be in the loop becuase i want the circle to move with the mouse if it is possible..i think iam going 2 have to make it have random little move moments..movements that are that big

I mean`t this

While 1
$X = 400;X co-ord for center of circle
$Y = 400;Y co-ord  "    "    "   "

before it was corrected... :whistle:

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

it works now...i just have to convert it too vb 6

#include <GUIConstants.au3>
#include <Math.au3>
$Stp =70;    Defines the smoothness of the circle and mouse speed
$Size = 3;Size of Circle
HotKeySet ("{ESC}", "quitme")
HotKeySet ("{SPACE}", "On")
While 1
Sleep(10)
WEnd

Func On()

$Pos = MouseGetPos()
While 1   
$X = $Pos[0];X co-ord for center of circle
$Y = $Pos[1];Y co-ord   
        For $R = 360 to 0 step -$Stp
            $Rad = _Radian ($R)
; next 3 lines are corrected
            $XX = Sin($Rad)*$Size + $X
            $YY= Cos($Rad)*$Size + $Y
            MouseMove($XX,$YY,1)

;add delay so the circle is not drawn too fast to see
               Sleep(20)

        Next
    WEnd
    EndFunc

Func quitme()
    Exit
EndFunc
Link to comment
Share on other sites

ummm...well, why bother coding at all in AutoIt if you are simply going to convert it to VB later? Seems like a waste of time. I don't code in VB, but if there is a snippit of code that moves the mouse pointer, I would start there.

Also, try this link: http://www.vbcity.com/forums/faq.asp?fid=38&cat=MouseIt may be of some help

Cheers!

Link to comment
Share on other sites

Well, let's distract ourselves from that interesting use of Autoit resources by considering this:

Global Const $PI = 3.1415926535897932384626433832795

Nice constant :whistle: I think, though, that if you have a somewhat normal screen size that 3.1416 should be of significant precision.

960 pixels x 3.1416 = 3015.936

960 pixels x 3.14159 = 3015.926

Reminded me of this: The absurdity of calculating Pi to trillions of digits.

BlueBearrOddly enough, this is what I do for fun.
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...