2

I am looking for a program working on Microsoft Windows 7 that can detect and give an alert or log whenever the mouse sensitivity is changed.

1 Answer 1

3

This can be accomplished easily through AutoIt, here's a script I created,

#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <WinAPIFiles.au3>

;Open/Create log.txt file
$file = FileOpen("log.txt", 1)

;Check to see if it could be opened/created ok
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open/create file.")
    Exit
EndIf

Func detectChanges()
    ;Get Mouse position
    $aPos = MouseGetPos();
    $bPos = MouseGetPos();
    ;See if the mouse position has changed (0 and 1 for x and y)
    While $bPos[0] = $aPos[0] Or $bPos[1] = $aPos[1]
        ;Keep getting new mouse position
        $bPos = MouseGetPos();
    WEnd
    ;Return new position
    Return MouseGetPos();
EndFunc   ;==>detectChanges

;Go on forever
While 1
    $position = detectChanges();
    writeToTextFile($position)
    alertBox($position);
WEnd

Func writeToTextFile($position)
    $time = "Sec: " & @SEC & " Min: " & @MIN & " Hour: " & @HOUR & " Day: " & @MDAY & " Month: " & @MON & " Year: " & @YEAR;
    $write = $time & " | X:" & $position[0] & " Y:" & $position[1] & @CRLF;
    FileWrite($file, $write)
EndFunc   ;==>writeToTextFile

Func alertBox($position)
    MsgBox($MB_SYSTEMMODAL, "Alert: Mousemovement", "Mouse x, y: " & $position[0] & ", " & $position[1])
EndFunc   ;==>alertBox

You can download the compiled version Here. You can turn on and off logs and alerts by commenting out (;) the functions. You may want to add some sort of a delay (Sleep(5000) ;<= sleeps for 5 seconds) every time detectChanges() runs or else the log file could get quite large. If you have any questions, ask away:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.