Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Mouse Movement & Click Recorder


  • Please log in to reply
51 replies to this topic
jethrow
  • Moderators
  • 2810 posts
  • Last active:
  • Joined: 24 May 2009
>>>Download Mouse Recorder.exe<<<

MouseRecorder.jpg
**VIEW SOURCE**

AutoHotkey_L and AHK Basic compatible

I thought something like this would be nice for those who just want to create mouse movement & clicking macros. Mouse Recorder will will record the Pressing & Releasing of the Left, Middle, & Right Click Buttons, along with Scrolling Up & Down.

Hotkeys:
CTRL+SHIFT+R: Start Recording
CTRL+SHIFT+S: Stop Recording/Playback
CTRL+SHIFT+P: Playback

Loop Playback:
Once you have recorded a script, you can play it back continuously by selecting Playback>>Loop. You can then stop this Playback by using the Stop Hotkey (CTRL+SHIFT+S).

Running .SMR Files (Script - Mouse Recorder) from AHK:
 

Command Line:
You can run a .SMR File with Command Line by using the .SMR File as the parameter. Here is an example in AHK:

RunWait, Mouse Recorder.exe "MyScript.smr"

PlaySMR() Function:
This function allows you to execute Mouse Recorder Code in your AHK Script. You could either specify the SMR File Path as the function parameter, or copy & paste the Mouse Recorder Code into your AHK script with the Copy menu item.

PlaySMR(script, relative="") {
   batchLines:=A_BatchLines, x:=y:=0
   SetBatchLines, -1
   if FileExist(script)
      FileRead, script, %script%
   if relative
      WinGetPos, x, y, , , A  
   Loop, Parse, script, .
   {
      if RegExMatch(A_LoopField,"(\d+),(\d+)",p) {
         DllCall("SetCursorPos", "Int",x+p1, "Int",y+p2)
         StoredX:=p1, StoredY:=p2
      }
      else if (A_LoopField = "+")
         DllCall("SetCursorPos", "Int",StoredX, "Int",StoredY)
      else
         Send {%A_LoopField%}
      Sleep 10
   }
   SetBatchLines, %batchLines%
}
;# NOTE: set the second Parameter as true to make the Mouse Movements relative to the active window


jarble
  • Guests
  • Last active:
  • Joined: --
I like this idea, but is there some way to save the scripts that are created as well as playing them back?

jethrow
  • Moderators
  • 2810 posts
  • Last active:
  • Joined: 24 May 2009
I was wondering if anyone would ever take an interest in this ... I updated the original post.

garath
  • Members
  • 398 posts
  • Last active: Feb 05 2011 10:31 PM
  • Joined: 24 Mar 2005
I like your solution.
Once ago, I did a Mouse-Recorder, too.
But yours is more handsome.

Best regards,
Garath

specter333
  • Members
  • 624 posts
  • Last active: May 25 2014 09:37 AM
  • Joined: 15 Jan 2007

I was wondering if anyone would ever take an interest in this ... I updated the original post.


I though this was great, the movement is very smooth. I made it into a module for a large script I'm working on, feel fee to take a look at a pre release. Just read the quick start pdf to learn how it works.
http://www.autohotke...EasyAuto V1.zip

EverythingInane
  • Guests
  • Last active:
  • Joined: --
This is amazing

But I was wondering, can you get it to record holding down too?

That would be awesome to draw pictures in paint or photoshop, and then erase them and watch it go!

EverythingInane
  • Guests
  • Last active:
  • Joined: --
also, how about the ability to set a loop for the recorded action?

KULA
  • Members
  • 2 posts
  • Last active: Feb 28 2011 06:50 AM
  • Joined: 10 Feb 2011
Can we set the mouse actions to play it continuously when a situation happens or a specific clipboard text is copied in clipboard? Am a newbie.. but this script works great....thanks...jethrow

jethrow
  • Moderators
  • 2810 posts
  • Last active:
  • Joined: 24 May 2009

... can you get it to record holding down too?

Done.

also, how about the ability to set a loop for the recorded action?

Can we set the mouse actions to play it continuously when a situation happens or a specific clipboard text is copied in clipboard?

I have no intentions of turning this into a AHK Script creating tool, but I did add command line support & a PlaySMR() function (see the original post). You could use either of these to execute your mouse movements from an AHK script.

vahju
  • Members
  • 337 posts
  • Last active: Sep 21 2014 03:52 AM
  • Joined: 17 Feb 2008
How about adding a Help menu item noting what the short cut keys are and a link to your post here.

If someone did want to loop what was already recorded, would you just put your function in a loop command.

How about a convert function. Takes the smr file and writes it in ahk syntax for ease of copy and pasting to other scripts. My use case for this is sharing with colleges that don't have the ahk chops to understand the function.

This script is awesome thanks for sharing.

jethrow
  • Moderators
  • 2810 posts
  • Last active:
  • Joined: 24 May 2009

If someone did want to loop what was already recorded, would you just put your function in a loop command.

Have you tried?

How about a convert function. Takes the smr file and writes it in ahk syntax for ease of copy and pasting to other scripts.

You can already hit the Copy menu item to put the script on the clipboard & paste it where you want.

My use case for this is sharing with colleges that don't have the ahk chops to understand the function.

Then what good would it be to put any of the script in an AHK script? They don't need to understand the function:
FileRead, script, MyScript.smr
PlaySMR(script)


  • Guests
  • Last active:
  • Joined: --
Just an idea...

Could you make it so that your screen "resets" when you press "Stop" ?

Like making windows return to the state as they were before recording.

Would make this script awesome for creating macros.

vgamesx1
  • Guests
  • Last active:
  • Joined: --
well I did find a few flaws in this compared to http://www.autohotke...pic.php?t=16473.
This has this nice GUI but I found that it can't record middle clicks or mouse scrolls.

So I would suggest looking at hes code then adding in recording for those aswell. because (to me anyway) thats a huge advange which I somewhat would need.

vgamesx1
  • Guests
  • Last active:
  • Joined: --
Oh yeah, also a good add to this is if you made a loop option.
like on the GUI add a checkbox that says "loop?".

and have it stop with Ctrl+Shift+S or something.

jethrow
  • Moderators
  • 2810 posts
  • Last active:
  • Joined: 24 May 2009

... it can't record middle clicks or mouse scrolls.

Easily Fixed.

... a loop option.

Good idea - I'll think about how I want to implement it.

If anyone wants to submit an icon, I'm open to using one. Also, I updated the PlaySMR() function to accept & play an SMR file if the path is specified in the Script Param.