SRL Archive - News and General

Key/Mouse Log help


YoHoJo

2011-12-01 14:44:33

I'm using http://villavu.com/forum/showthread.php?t=3197 to keylog myself but it doesn't record mouse movements.

Can someone either link me to, or write a simple script that will writeln or save to file all of my mouse movements and clicks including left/right click and coordiantes please?

What is IsMouseButtonDown(1)/2 which is left/right?

How do I make it so it doesn't writeln the mousepos if my mouse hasn't moved?
Currently it spams mousepos even if mouse hasn't moved, tried to do it but failed

program new;
var x,y, q, w:Integer;
begin
repeat
If x<>w Then
Begin
GetMousePos(x,y);
Writeln(IntToStr(x) + ',' + IntToStr(y));
End;
GetMousePos(q,w);
If IsMouseButtonDown(1) Then
Writeln('MouseDown 1 ');
If IsMouseButtonDown(2) Then
Writeln('MouseDown 2');
Until(false)
end.

1 is left click
2 is right click

i luffs yeww

2011-12-01 15:29:19

Have a LastPos and CurrPos TPoint. LastPos at start will just be -1, -1 (or 0, 0, doesn't matter), and CurrPos will be GetMousePos(CurrPos.x, CurrPos.y);. if((CurrPos.x <> LastPos.x) and (CurrPos.y <> LastPos.y))then Writeln(ToStr(CurrPos.x) + ', ' + ToStr(CurrPos.y)); LastPos := CurrPos;

YoHoJo

2011-12-01 15:40:50

how do I?
I know
CurrentPos:= Point(GetMousePos(x,y)); is wrong, what do I do.

got it!
program new;
var x,y, q, w:Integer;
LastPos, CurrentPos:Tpoint;

begin
repeat
GetMousePos(x,y)
CurrentPos:= Point(x, y);
If CurrentPos.X <> LastPos.X Then
Begin
Writeln(IntToStr(x) + ',' + IntToStr(y));
End;
GetMousePos(q,w);
LastPos:= Point(q,w);
If IsMouseButtonDown(1) Then
Writeln('MouseDown 1 ');
If IsMouseButtonDown(2) Then
Writeln('MouseDown 2');
Until(false)
end.

E: Not working in some cases, any better way to do it, do I need to switch some lines to make it respond better?

E: Whatevas made another similar quick script, figured out what I wanted to.

mormonman

2011-12-01 15:46:05

program new;

var
LastPos, CurrentPos:Tpoint;

begin
LastPos := Point(-1, -1);
repeat
GetMousePos(CurrentPos.x, CurrentPos.y);
If CurrentPos <> LastPos Then
Begin
LastPos := CurrentPos;
writeln(LastPos);
End;
If IsMouseButtonDown(1) Then
Writeln('MouseDown 1 ');
If IsMouseButtonDown(2) Then
Writeln('MouseDown 2');
Until(false)
end.

YoHoJo

2011-12-01 15:48:04

Flippin perfect thanks!
E:MoMo, can you add so it notes the time the mouse button is held down and then released?
Basically how many ms between hold down and release please.

mormonman

2011-12-01 15:48:23

program new;

var
LastPos, CurrentPos:Tpoint;

begin
LastPos := Point(-1, -1);
repeat
GetMousePos(CurrentPos.x, CurrentPos.y);
If CurrentPos <> LastPos Then
Begin
LastPos := CurrentPos;
writeln(LastPos);
End;
If IsMouseButtonDown(mouse_Right) Then
Writeln('MouseDown mouse_Right');
If IsMouseButtonDown(mouse_Left) Then
Writeln('MouseDown mouse_Left');
If IsMouseButtonDown(mouse_Middle) Then
Writeln('MouseDown mouse_Middle');
Until(false);
end.

YoHoJo

2011-12-01 15:51:31

I said have it write the ms between the down/up of the mouse please please :D! Sorry I'm being a froob :/.!
Gonna have to include srl and use MarkTime

Talked to momomo on MSN, all is well!
program new;
{.include SRL/SRL.scar}
var
LastPos, CurrentPos: TPoint;
T: Boolean;
DownKey: Integer;

begin
LastPos := Point(-1, -1);
repeat
GetMousePos(CurrentPos.x, CurrentPos.y);
If CurrentPos <> LastPos Then
Begin
LastPos := CurrentPos;
writeln(LastPos);
End;
If IsMouseButtonDown(mouse_Right) Then
Begin
MarkTime(DownKey);
While IsMouseButtonDown(mouse_Right) Do
Wait(1);
Writeln('MouseDown mouse_Right');
Writeln(IntToStr(TimeFromMark(DownKey)) + 'ms');
End;
If IsMouseButtonDown(mouse_Middle) Then
Begin
MarkTime(DownKey);
While IsMouseButtonDown(mouse_Middle) Do
Wait(1);
Writeln('MouseDown mouse_Middle');
Writeln(IntToStr(TimeFromMark(DownKey)) + 'ms');
End;
If IsMouseButtonDown(mouse_Left) Then
Begin
MarkTime(DownKey);
While IsMouseButtonDown(mouse_Left) Do
Wait(1);
Writeln('MouseDown mouse_Left');
Writeln(IntToStr(TimeFromMark(DownKey)) + 'ms'); 5
End;
Until(false);
end.

footballjds

2011-12-01 16:36:03

Yo Ho,

You've been around too long to be getting this kind of help on easy stuff!!! :P

Yago

2011-12-01 18:26:48

From: footballjds
Yo Ho,

You've been around too long to be getting this kind of help on easy stuff!!! :P


Triple and double posts too :p jk We love you YoHoJo

YoHoJo

2011-12-01 18:35:41

From: Yago
Triple and double posts too :p jk We love you YoHoJo


Merged em!

Yago

2011-12-01 18:37:38

From: YoHoJo
Merged em!


grr Do Not Conform…

Ontopic: Did you get the script to work?

YoHoJo

2011-12-01 18:45:09

End result, all good:
program new;
{.include SRL/SRL.scar}
var
LastPos, CurrentPos: TPoint;
T: Boolean;
DownKey: Integer;

begin
LastPos := Point(-1, -1);
repeat
GetMousePos(CurrentPos.x, CurrentPos.y);
If CurrentPos <> LastPos Then
Begin
LastPos := CurrentPos;
writeln(LastPos);
End;
If IsMouseButtonDown(mouse_Right) Then
Begin
MarkTime(DownKey);
While IsMouseButtonDown(mouse_Right) Do
Wait(1);
Writeln('MouseDown mouse_Right');
Writeln(IntToStr(TimeFromMark(DownKey)) + 'ms');
End;
If IsMouseButtonDown(mouse_Middle) Then
Begin
MarkTime(DownKey);
While IsMouseButtonDown(mouse_Middle) Do
Wait(1);
Writeln('MouseDown mouse_Middle');
Writeln(IntToStr(TimeFromMark(DownKey)) + 'ms');
End;
If IsMouseButtonDown(mouse_Left) Then
Begin
MarkTime(DownKey);
While IsMouseButtonDown(mouse_Left) Do
Wait(1);
Writeln('MouseDown mouse_Left');
Writeln(IntToStr(TimeFromMark(DownKey)) + 'ms');
End;
Until(false);
end.

Yago

2011-12-01 18:51:07

Cool I might take a look at this puppy :)