Jump to content

Record mouse movements


Rejectedz
 Share

Recommended Posts

Here's a script I made forever ago...

When you record it will make an .ini file in the script directory... so when you click "Reconstruct" just go to the script directory and select the .ini file that has the time you made the recording...

#include <GuiConstants.au3>
#Include <Misc.au3>
#NoTrayIcon 

Opt("GUICloseOnESC", 1) 

$gui = GuiCreate("Mouse movement recorder/player", 350, 156, -1, -1, $GUI_SS_DEFAULT_GUI , BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
GUISetBkColor (0xA29CFE)
$start = GuiCtrlCreateButton("Start Recording", 10, 10, 330, 25)
$stop = GuiCtrlCreateButton("Stop Recording", 10, 45, 330, 25)
    GuiCtrlSetState($stop, $GUI_DISABLE)
$prompt = GuiCtrlCreateLabel("If you would like to reconstruct a prior recording click 'Reconstruct'...", 10, 80, 330, 15)
$playPrior = GuiCtrlCreateButton("Reconstruct", 10, 100, 330, 25)
$checkDown = GuiCtrlCreateCheckBox("Reconstruct with left mouse button held down", 10, 130, 330, 20)

WinSetTrans("Mouse movement recorder/player", "", 0)
GUISetState(@SW_Show)
_WinFade($gui, 0, 250, 15, 5, 0)
WinSetTrans("Mouse movement recorder/player", "", 255)

While 1 
    $msg = GuiGetMsg()
    Select 
        Case $msg = $start
            GuiCtrlSetState($start, $GUI_DISABLE)
            GuiCtrlSetState($stop, $GUI_ENABLE)
            _WinFade($gui, 250, 100, 15, 5, -1)
            $time = @HOUR & "-" & @MIN & "-" & @SEC
            Do 
                $pos = MouseGetPos()
                $msg = GuiGetMsg()
                IniWrite(@ScriptDir & "\Recording time was " & $time &  ".ini", @MON & ":" & @MDAY & ":" & @YEAR, @Sec & " " & "click", "")
                IniWrite(@ScriptDir & "\Recording time was " & $time &  ".ini", @MON & ":" & @MDAY & ":" & @YEAR, @Sec & " " & $pos[0], $pos[1])
                Sleep(20)
                If $msg = $GUI_EVENT_CLOSE then Exit 
            Until $msg = $stop
            _WinFade($gui, 100, 250, 15, 5, 0)
            GuiCtrlSetState($start, $GUI_ENABLE)
            GuiCtrlSetState($stop, $GUI_DISABLE)
        Case $msg = $playPrior 
            $file = FileOpenDialog("Choose a .ini file that contains coordinates from before", @DesktopCommonDir & "\Mouse Positions", "(*.ini)", 0)
            If Not @ERROR Then 
                GuiSetState(@SW_DISABLE)
                $iniName = IniReadSectionNames($file)
                $coords = IniReadSection($file, $iniName[1])
                GuiCtrlSetData($prompt, "Esc exits!")
                If BitAnd(GUICtrlRead($checkDown),$GUI_CHECKED) = $GUI_CHECKED then MouseDown("left")
                For $a = 1 to $coords[0][0]
                    $temp = StringSplit($coords[$a][0], " ")
                    If $temp[2] = "click" then 
                        MouseClick("left")
                    Else
                        MouseMove($temp[2], $coords[$a][1], 3)
                    EndIf
                    If _IsPressed("1B") then Exit
                    Next
                If BitAnd(GUICtrlRead($checkDown),$GUI_CHECKED) = $GUI_CHECKED then MouseUp("left")
                GuiCtrlSetData($prompt, "If you would like to reconstruct a prior recording click 'Reconstruct'...")
                GuiSetState(@SW_ENABLE)
            EndIf
        Case $msg = $GUI_EVENT_CLOSE
            _WinFade($gui, 250, 0, 15, 5, -1)
            Exit
    EndSelect
    Sleep(50)
Wend

Func _WinFade($hWnd, $iStart, $iEnd, $iStep = 3, $iSleep = 1, $iFade = 1); $iFade - 1 = Fade Out - 0 = Fade In
    If $iFade Then
        For $iCount = $iStart To $iEnd Step - $iStep
            WinSetTrans($hWnd, '', $iCount)
            Sleep($iSleep)
        Next
        Return 1
    ElseIf Not $iFade Then
        For $iCount = $iStart To $iEnd Step $iStep
            WinSetTrans($hWnd, '', $iCount)
            Sleep($iSleep)
        Next
        Return 1
    EndIf
    Return SetError(1, 0, 0)
EndFunc
Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

brett has major problems with spelling... like: Again...he spells it aging

You better not be talking about me.

EDIT: And how is this related to this topic?

OHHHHHHHHH!!!!!!!!!! 3000 posts! :)

Edited by Bert
Link to comment
Share on other sites

I'm fairly sure that you Bert's real name is Brett... Or at least what he's told us to be his real name :)

Yes sir. You are correct there... :P I was just mucking around. Yet I am still to understand where insulting someone's spelling skills helps in this thread. Just trying to prove a point. And did I mention that Swift had major problems with grammar?
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...