move mouse in a circle
center = 800,450 ( my screen's center, it never changes )
radius = 50
help me with this script
Mouse move in a circle whoes center is ....
Re: Mouse move in a circle whoes center is ....
Maybe:I hope this helps ![Smile :)](./images/smilies/icon_e_smile.gif)
Code: Select all
for i, Point in GeneratePoints(800, 450, 50) {
MouseMove, Point.1, Point.2, 0
}
; GeneratePoints - generates an array of points on a circle.
; PointsN = number of points
GeneratePoints(CentX, CentY, Radius, PointsN := 25) {
Points := [], PI := 4 * ATan(1), Step := PI / (PointsN // 2), Quadrant := PointsN // 4
Loop, % Quadrant {
Rads := A_Index * Step
X := Cos(Rads) * Radius
Y := Sin(Rads) * Radius
Points[A_Index] := [CentX + X, CentY + Y]
Points[(Quadrant * 2) - A_Index] := [CentX - X, CentY + Y]
Points[A_Index + (Quadrant * 2)] := [CentX - X, CentY - Y]
Points[(Quadrant * 4) - A_Index ] := [CentX + X, CentY - Y]
}
return Points
}
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: Mouse move in a circle whoes center is ....
another one:
Code: Select all
CoordMode, Mouse, Screen
MoveMouse_Circle(800, 450, 50, 36) ; use 36 steps
;-------------------------------------------------------------------------------
MoveMouse_Circle(cx, cy, r, s) { ; move mouse in a circle
;-------------------------------------------------------------------------------
$Pi := 4 * ATan(1)
MouseMove, cx + r, cy, 0
Loop, % s ; number of steps
MouseMove, cx + r * Cos(A_Index * 2 * $Pi / s)
, cy + r * Sin(A_Index * 2 * $Pi / s)
}
Re: Mouse move in a circle whoes center is ....
Code: Select all
CoordMode, Mouse, Screen
SetBatchLines -1
len := 50 ; Radius
wPos := A_ScreenWidth/2 ; X center
hPos := A_ScreenHeight/2 ; Y center
;steps: Slower << 360,180,120,90,72,60,45,36,30,24,18,10,9 >> Faster.
steps := 9
point := (360/steps)
1::
Loop % steps
{
GetPosFromAngle(mx,my,wPos,hPos,len,A_Index*point)
MouseMove,mx,my,0
}
return
GetPosFromAngle(ByRef x2,ByRef y2,x1,y1,len,ang)
{ ; MasonJar13
ang := (ang-90) * 0.0174532925
x2 := x1 + len * cos(ang)
y2 := y1 + len * sin(ang)
}
Re: Mouse move in a circle whoes center is ....
Oops ! I didn't replay to your answers ? I am sorry in that case!
I tried all the scripts and all works like charm !
Thanks for quick replay. U guys are genious !
![Smile :)](./images/smilies/icon_e_smile.gif)
I tried all the scripts and all works like charm !
Thanks for quick replay. U guys are genious !
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: Mouse move in a circle whoes center is ....
Has anyone tried hooking one of these script up to a shortcut? Once I have selected the freeform snip in the windows snipping tool I would like to be able to run this code. An issue is that the circle will be of varying size depending on the snip. ANy advice appreciated.
Who is online
Users browsing this forum: Google [Bot], mstrauss2021, robozao, TAC109 and 231 guests