AutoHotkey Community

It is currently May 27th, 2012, 10:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: November 19th, 2007, 4:46 pm 
this would be my question. is it possible to program autohotkeys to do this:

i press a key on the keyboard. mouse cursor moves to a certain point and makes a click down. then i scroll the mouse wheel and the cursor moves circularly say clockwise with a radius of approx 100 pixels. (so that the starting point is a point on the circle) when i scroll mouse wheel the other way then cursor moves counter clockwise with the same radius. i press the key again and it releases the mouse cursor. (makes a click up)

i know how to program move cursor with keys and do different clicks, but circular movement is bit hard to me. anyone knows a solution? or maybe a different software to to this?

I'm trying to automate some program I'm using. and for changing values there you gotta circulate the mouse over its buttons on the interface. problem is that you should look at a different monitor at the same time. and this really makes it uncomfortable and time consuming.

thanks for help, if there will be any,
regards,
mart taniel,
filmmaker


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2007, 5:41 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
Something to get you started:

Code:
pi = 3.141592653589793
rad2degree(rad)
{
  global pi
  return rad*180/pi
}

degree2rad(degree)
{
  global pi
  return degree*pi/180
}

f11::
  MouseGetPos, baseX, baseY
  Angle = 0
  Return

WheelUp::
  Angle += 30
  newX := baseX + 100*sin(degree2rad(angle))
  newY := baseY + 100*cos(degree2rad(angle))
  MouseMove, %newX%, %newY%
  Return
 
WheelDown::
  Angle -= 30
  newX := baseX + 100*sin(degree2rad(angle))
  newY := baseY + 100*cos(degree2rad(angle))
  MouseMove, %newX%, %newY%
  Return

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2007, 6:25 pm 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
or alternatively to tonnes you could use the equation for a circle:

(x - h)2 + (y - k)2 = r2

Press ctrl and p to start the mouse moving in a circle. The radius of the circle can be changed and its X,Y offset (this being the coordinates of the centre of the circle)

Code:
SetBatchLines, -1

Radius := 250
CentreX := 500
CentreY := 500

x := Radius

^p::

Loop
{
   x++
   y := Round(Sqrt((Radius**2) - ((x - CentreX)**2)) + CentreY)
   
   Mousemove, %x%, %y%
   
   If x >= % CentreX + Radius
   Break
}


Loop
{
   x--
   y := CentreY - (Round(Sqrt((Radius**2) - ((x - CentreX)**2)) + CentreY) - CentreY)
   
   Mousemove, %x%, %y%
   
   If x <= %Radius%
   Break
}
Return

Esc::ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2007, 6:59 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
both are pretty cool

I was playing around with the first one, and got
Code:
SetBatchLines, -1
SetDefaultMouseSpeed, 0

pi = 3.141592653589793
Radius = 100
rad2degree(rad)
{
  global pi
  return rad*180/pi
}

degree2rad(degree)
{
  global pi
  return degree*pi/180
}

f11::
  MouseGetPos, baseX, baseY
  baseY -= Radius
  Angle = 0
  Return

WheelUp::
  Loop, 10
  {
    Angle += 4.5
    newX := baseX + Radius*sin(degree2rad(angle))
    newY := baseY + Radius*cos(degree2rad(angle))
    MouseMove, %newX%, %newY%
  }
  Return
 
WheelDown::
  Loop, 10
  {
    Angle -= 4.5
    newX := baseX + Radius*sin(degree2rad(angle))
    newY := baseY + Radius*cos(degree2rad(angle))
    MouseMove, %newX%, %newY%
  }
  Return
 
esc::ExitApp

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2007, 11:18 pm 
this rocks. i'll program my keyboard and mouse instead of buying hyper expensive equipment. thanks a bunch guys

mart


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2008, 2:28 am 
Offline

Joined: October 21st, 2008, 2:21 am
Posts: 5
Thank you guys for the codes..

I was looking for a script to make a circle with cursor
and you all were very helpful

:D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2009, 4:03 pm 
engunneer wrote:
both are pretty cool

I was playing around with the first one, and got
Code:
SetBatchLines, -1
SetDefaultMouseSpeed, 0

pi = 3.141592653589793
Radius = 100
rad2degree(rad)
{
  global pi
  return rad*180/pi
}

degree2rad(degree)
{
  global pi
  return degree*pi/180
}

f11::
  MouseGetPos, baseX, baseY
  baseY -= Radius
  Angle = 0
  Return

WheelUp::
  Loop, 10
  {
    Angle += 4.5
    newX := baseX + Radius*sin(degree2rad(angle))
    newY := baseY + Radius*cos(degree2rad(angle))
    MouseMove, %newX%, %newY%
  }
  Return
 
WheelDown::
  Loop, 10
  {
    Angle -= 4.5
    newX := baseX + Radius*sin(degree2rad(angle))
    newY := baseY + Radius*cos(degree2rad(angle))
    MouseMove, %newX%, %newY%
  }
  Return
 
esc::ExitApp





Is there any way to speed this circle up? I need it faster. "0" is as fast as it will go as is.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2009, 7:07 pm 
Offline

Joined: May 24th, 2007, 3:45 am
Posts: 1121
boddie wrote:
Is there any way to speed this circle up? I need it faster. "0" is as fast as it will go as is.

You could make it move in larger steps, by replacing this:
Code:
  Loop, 10
  {
    Angle -= 4.5

with this:
Code:
  Loop, 5
  {
    Angle -= 9


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, chaosad, robotkoer, specter333, Yahoo [Bot] and 77 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group