Jump to content

Mouse record?


XxSunxX
 Share

Recommended Posts

I was thinking of something when something hit me. I was wondering if its possible to like...

-Hit a button (Like record)

-Move your mouse around (Would really like recorded clicks aswell)

-Hit a buttom (Like stop) (A hotkey would work better)

-Pick play and it plays what your mouse did

Yes this is probably alot to do but all I wanted to know is...

Is it possible?

If so could I be helped on making a script for it.

Link to comment
Share on other sites

I was thinking of something when something hit me. I was wondering if its possible to like...

-Hit a button (Like record)

-Move your mouse around (Would really like recorded clicks aswell)

-Hit a buttom (Like stop) (A hotkey would work better)

-Pick play and it plays what your mouse did

Yes this is probably alot to do but all I wanted to know is...

Is it possible?

If so could I be helped on making a script for it.

Hey, I started this a while ago... I was going to add in clicks and all that but I got distracted.

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

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)

GUISetState()

While 1 
    $msg = GuiGetMsg()
    Select 
        Case $msg = $start
            GuiCtrlSetState($start, $GUI_DISABLE)
            GuiCtrlSetState($stop, $GUI_ENABLE)
            $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
            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
            Exit
    EndSelect
    Sleep(50)
Wend

Hopefully this can get you started...

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

  • Moderators

Wow that is very nice. When I rip it apart and make my own GUI, want credits or just want this "THANKS"?

Rip it apart?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Scite4AutoIt3 already has Au3Record builtin if you just want to record?

http://www.autoitscript.com/autoit3/scite/docs/AU3record.htm

:whistle:

Ya... I have installed the very latest version of AutoIT3. But i didn't find the Mouse recorder in that. I have downloded the separate exe file and i'm using it. But i don't find that is accurate. Its not giving the proper recording as i want. Can u pls help me out on this....

Thanks & Regards

Manickam

Link to comment
Share on other sites

Ya... I have installed the very latest version of AutoIT3. But i didn't find the Mouse recorder in that. I have downloded the separate exe file and i'm using it. But i don't find that is accurate. Its not giving the proper recording as i want. Can u pls help me out on this....

Thanks & Regards

Manickam

I assume you have the full Scite4AutoIt3 Installer. As for an issue of accuracy or proper recording is a little fuzzy to comprehend. Can you give an example of the problems that you seem to be experiencing? :whistle:
Link to comment
Share on other sites

Sorry if I'm responding to a thread that's too old, but I thought I my add a code I've been trying to do (though ultimately ended up putting a pause to the development until a later date since it was becoming more of a collection of add-ons from the help I got).

http://four.fsphost.com/BALA/pages/ba-auto_BETA.html

#include <Misc.au3>
#include <GUIConstants.au3>

HotKeySet("{F1}", "On")
HotKeySet("{F2}", "Off")
HotKeySet("{F3}", "Play")
HotKeySet("{F4}", "Stop")

Global $trigger = 0
Global $score = 0
Global $click = 1
Global $click2 = -1
Dim $Position, $i = 0, $Record[1]

Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("BA-AUTO *BETA*", 200, 160)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$on = GUICtrlCreateButton("On (F1)", 40, 10, 120)
GUICtrlSetOnEvent($on, "On")
$off = GUICtrlCreateButton("Off (F2)", 40, 40, 120)
GUICtrlSetOnEvent($off, "Off")
$play = GUICtrlCreateButton("Play (F3)", 40, 90, 120)
GUICtrlSetOnEvent($play, "Play")
$stop = GUICtrlCreateButton("Stop (F4)", 40, 120, 120)
GUICtrlSetOnEvent($stop, "Stop")
GUISetState(@SW_SHOW)

Func CLOSEClicked()
  Exit
EndFunc

Func On()
    $score = 1
EndFunc

Func Off()
    $score = 0
EndFunc

Func Play()
    $trigger = 1
EndFunc

Func Stop()
    $trigger = 0
EndFunc

While 1
    While 1
        If $score = 1 Then
            If _IsPressed("01") Then
                $click = $click + 1
                $Position = MouseGetPos()
                $x = $Position[0]
                $y = $position[1]
                ReDim $Record[$i + 2]
                $Record[$i] = $x
                $Record[$i + 1] = $y
                $i += 2
            EndIf
            sleep(10)
        EndIf
        If $score = 0 Then
            ExitLoop
        EndIf
    WEnd

    While 1
        If $trigger = 1 Then
            For $n = 0 to $click
                $a = $click2 + 1
                $b = $click2 + 2
                MouseClick("left", $Record[$a], $Record[$b], 1)
                $click2 = $click2 + 2
                If $n = $click - 2 Then
                    $click2 = -1
                    $n = 0
                EndIf
                If $trigger = 0 Then
                    ExitLoop
                EndIf
            Next
        EndIf
        If $trigger = 0 Then
            ExitLoop
        EndIf
    WEnd
WEnd

I'm not sure if this is as good as Piano_Man's, but it's an attempt I made when I was first starting AutoIt.

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
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...