Jump to content

Recommended Posts

Posted

I'm wondering if anyone has been able to (or if autoit even can) do either of the following:

1. record a mouse drag (example: I click in the center of the screen, and drag to the top right), and save it to a .ini file (like cords)

2. Create a visible grid over the entire screen, transparent background and thin lines.

Posted

1. record a mouse drag (example: I click in the center of the screen, and drag to the top right), and save it to a .ini file (like cords)

Somthing like this:

#include <Misc.au3>

$IniFile = @ScriptDir & "\Test.ini"

While Not _IsPressed("01")
    Sleep(100)
WEnd

$MousePosStart = MouseGetPos()
IniWrite($IniFile, "Mouse Record", "Start XPos", $MousePosStart[0])
IniWrite($IniFile, "Mouse Record", "Start YPos", $MousePosStart[1])

While 1
    Sleep(100)
    If _IsPressed("01") Then ExitLoop
WEnd

$MousePosEnd = MouseGetPos()
IniWrite($IniFile, "Mouse Record", "End XPos", $MousePosEnd[0])
IniWrite($IniFile, "Mouse Record", "End YPos", $MousePosEnd[1])

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

The lines are simply cool MsCreatoR.

Thanks for sharing.

gsb

"Did you ever stop to think? ...and forget to restart!"
Posted (edited)

omg, I love you. I havent tested this out yet, but thats exactly what I want from description, even down to the left clicking! :whistle:.

This has been driving me crazy for awhile, Im very close to done with my first bot, and this will make it infinitely better! Thank you :)!!

EDIT: Only 1 thing, I need the mouse tracker to record every step of the mouse, not just the start/end. I found 1 script that came close, but it required a GUI to it, and when I was working on it to switch it over I couldn't get it, but I'm sure you would have no prob there

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.2.2.0
    Author:      Andy
    
    Script Function:
    Mouse tracker
    
#ce ----------------------------------------------------------------------------
#include <Misc.au3>
#Include <GuiEdit.au3>
#Include <GuiStatusBar.au3>

HotKeySet ("!e","End")
$GUI =   GUICreate ("Basic Script ~ Writer",250,280)
$script =   GUICtrlCreateEdit ("there is an inputbox in the status bar with" & @CRLF & "how long you want it to record for. The box" & @CRLF & "next to the is the defult delay after each" & @CRLF & "movement. There is also a Test button to" & @CRLF & "check the Script. It can only move the " & @CRLF & "mouse and sleep. Alt+e also exits",10,10,230,200)
$time =  GUICtrlCreateInput ("sec",60,260,25,18,$ES_NUMBER)
$time2 =    GUICtrlCreateInput ("delay",90,260,25,18,$ES_NUMBER)
$Exit =  GUICtrlCreateButton ("&Exit",170,218,70,30)
$Save =  GUICtrlCreateButton ("&Save",10,218,70,30)
$lines =     _GUICtrlEditGetLineCount ($script)
$test =  GUICtrlCreateButton ("TEST",120,260,40,18)
$REC =   GUICtrlCreateButton ("&RECORD",85,213,80,40)
Local $Parts[3] = [55, 350, -1]
Local $Text[3] = ["Lines: " & $lines,"", "Even More Text"]
$status =   _GUICtrlStatusBarCreate ($GUI,$Parts,$Text)
GUICtrlSetColor ($time,0xFF0000)
GUICtrlSetColor ($time2,0xFF0000)
GUISetBkColor (0xD3D3D3)
GUISetState()

While 1
$msg = GUIGetMsg()
    Select
        Case $msg = $Exit
        Exit
        Case $msg = $Save
            $script = GUICtrlRead ($script)
            FileWrite (@ScriptDir & "\Script.au3",$script)
            Sleep (2000)
            MsgBox (64,"SAVED","Script Saved at " & @ScriptDir & "\Script.au3 <-")
        Case $msg = $REC
            IniDelete ("MousePos.ini","Coords")
            GUICtrlSetData ($Script,"")
            $time3 = GUICtrlRead ($time) * 1000
            $delay = GUICtrlRead ($time2)
            $lines =     _GUICtrlEditGetLineCount ($script)
            _GUICtrlStatusBarSetText ($status,"Lines: " & $lines,0)
            $x = 1
            $y = 1
            $begin = TimerInit()
            Do
            Sleep (10)
            $mouse = MouseGetPos()
            IniWrite (@ScriptDir & "\MousePos.ini","Coords","x" & $x,$mouse[0])
            IniWrite (@ScriptDir & "\MousePos.ini","Coords","y" & $y,$mouse[1])
            $x = $x + 1
            $y = $y + 1
            $dif = TimerDiff ($begin)
            Until $dif >= $time3
            Sleep (1000)
            $x = 1
            $y = 1
            $begin = TimerInit()
            Do
            Sleep (10)
            $mousex = IniRead (@ScriptDir & "\MousePos.ini","Coords","x" & $x,$mouse[0])
            $mousey = IniRead (@ScriptDir & "\MousePos.ini","Coords","y" & $y,$mouse[1])
            ControlSend ("Basic Script ~ Writer","","Edit1","MouseMove ("& $mousex &","& $mousey &",1){ENTER}")
            ControlSend ("Basic Script ~ Writer","","Edit1","Sleep ("& $delay &"){ENTER}")
            $x = $y + 1
            $y = $y + 1
            $lines =     _GUICtrlEditGetLineCount ($script)
            _GUICtrlStatusBarSetText ($status,"Lines: " & $lines,0)
            $dif = TimerDiff ($begin)
            Until $dif >= $time3
        Case $msg = $test
            $begin = TimerInit()
            Do
            Sleep (10)
            $mousex = IniRead (@ScriptDir & "\MousePos.ini","Coords","x" & $x,$mouse[0] & "DEFULT")
            $mousey = IniRead (@ScriptDir & "\MousePos.ini","Coords","y" & $y,$mouse[1] & "DEFULT")
            MouseMove ($mousex,$mousey,1)
            $x = $y + 1
            $y = $y + 1
            $dif = TimerDiff ($begin)
            Until $dif >= $time3
    EndSelect
WEnd
   
Func End()
    Exit
EndFunc
Edited by verto
Posted

I “transform” this idea to a function, check this out :whistle:

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

But how do you want it to be writen to an ini file? this must be somthing like time logger...

#include <Misc.au3>

$IniFile = @ScriptDir & "\Test.ini"

Do
    Sleep(100)
Until _IsPressed("01")

$MousePosStart = MouseGetPos()
IniWrite($IniFile, "Mouse Record", "XPos Started at: " & @HOUR & ":" & @MIN & ":" & @SEC, $MousePosStart[0])
IniWrite($IniFile, "Mouse Record", "YPos Started at: " & @HOUR & ":" & @MIN & ":" & @SEC, $MousePosStart[1])

Sleep(200) ;We will give some time to dll of _IsPressed() to close

Do
    $MousePosWhile = MouseGetPos()
    IniWrite($IniFile, "Mouse Record", "XPos Moved at: " & @HOUR & ":" & @MIN & ":" & @SEC, $MousePosWhile[0])
    IniWrite($IniFile, "Mouse Record", "YPos Moved at: " & @HOUR & ":" & @MIN & ":" & @SEC, $MousePosWhile[1])
Until _IsPressed("01")

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

well, I think I almost have it, I'm just making one seriously newbish mistake, I cant close it properly lol.

So If I could get this to stop recording when I release my mouse button rather than just clicking randomly everywhere..... ya...

#include <Misc.au3>
HotKeySet("{esc}", "Quit")
$IniFile = @ScriptDir & "\Test.ini"
$mouse = MouseGetPos()
$x = 1
$y = 1
While MouseDown("left")
 Do
            IniWrite (@ScriptDir & "\MousePos.ini","Coords","x" & $x,$mouse[0])
            IniWrite (@ScriptDir & "\MousePos.ini","Coords","y" & $y,$mouse[1])
            $x = $x + 1
            $y = $y + 1
            Until MouseUp("left")
WEnd

Func Quit()
    Exit
EndFunc
Edited by verto
Posted

well, I think I almost have it, I'm just making one seriously newbish mistake, I cant close it properly lol.

So If I could get this to stop recording when I release my mouse button rather than just clicking randomly everywhere..... ya...

But if you test that, and look at the output of it, you will see what I want

And it needs to be just from mouse down to mouse up

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...