SRL Archive - Other Scripts

Mouse/Click/Key Logger


JuKKa

2007-10-09 09:37:10

What this script does is when you run it
  1. Records Your Mouse/Clicks/Keys movements/presses
  2. Until YOU press "f12"
  3. Then it will play back them

Known Bugs
Dont type too fast or it wont record them.
Dont know if it supports right clicks.

Took my about 10 minutes to make i was bored.


Program MouseListener;

Var
MouseMoveMent: Array Of TPoint;
WhatKey: Array Of String;
KeyPress: Array Of Boolean;
MouseClick: Array Of Boolean;

Const
RepeatMouseMoveMent = True;
Times = 5;

Function IsAnyKeyDown: Boolean;
Begin
If(IsKeyDown('a'))Or(IsKeyDown('b'))Or(IsKeyDown('c'))Or(IsKeyDown('d'))Or
(IsKeyDown('e'))Or(IsKeyDown('f'))Or(IsKeyDown('g'))Or(IsKeyDown('h'))Or
(IsKeyDown('i'))Or(IsKeyDown('j'))Or(IsKeyDown('k'))Or(IsKeyDown('l'))Or
(IsKeyDown('m'))Or(IsKeyDown('n'))Or(IsKeyDown('o'))Or(IsKeyDown('p'))Or
(IsKeyDown('q'))Or(IsKeyDown('r'))Or(IsKeyDown('s'))Or(IsKeyDown('t'))Or
(IsKeyDown('u'))Or(IsKeyDown('v'))Or(IsKeyDown('w'))Or(IsKeyDown('x'))Or
(IsKeyDown('y'))Or(IsKeyDown('z'))
Or
(IsKeyDown('0'))Or(IsKeyDown('1'))Or(IsKeyDown('2'))Or(IsKeyDown('3'))Or
(IsKeyDown('4'))Or(IsKeyDown('5'))Or(IsKeyDown('6'))Or(IsKeyDown('7'))Or
(IsKeyDown('8'))Or(IsKeyDown('9'))Then Result:= True;
End;

Function WhatKeyIsDown: String;
Var
Keys: Array of Char;
I: Integer;
Begin
SetArrayLength(Keys, 36);
Keys[0]:= 'a';
Keys[1]:= 'b';
Keys[2]:= 'c';
Keys[3]:= 'd';
Keys[4]:= 'e';
Keys[5]:= 'f';
Keys[6]:= 'g';
Keys[7]:= 'h';
Keys[8]:= 'i';
Keys[9]:= 'j';
Keys[10]:= 'k';
Keys[11]:= 'l';
Keys[12]:= 'm';
Keys[13]:= 'n';
Keys[14]:= 'o';
Keys[15]:= 'p';
Keys[16]:= 'q';
Keys[17]:= 'r';
Keys[18]:= 's';
Keys[19]:= 't';
Keys[20]:= 'u';
Keys[21]:= 'v';
Keys[22]:= 'w';
Keys[23]:= 'x';
Keys[24]:= 'y';
Keys[25]:= 'z';

Keys[26]:= '0';
Keys[27]:= '1';
Keys[28]:= '2';
Keys[29]:= '3';
Keys[30]:= '4';
Keys[31]:= '5';
Keys[32]:= '6';
Keys[33]:= '7';
Keys[34]:= '8';
Keys[35]:= '9';
For I:= 0 To 35 Do
If(IsKeyDown(Keys[I]))Then
Begin
Result:= Keys[I];
Exit;
End;
End;

Procedure RecordMouse;
Var
X, Y, SysWait: Integer;
Begin
SysWait := GetSystemTime;
While(Not IsFKeyDown(12))Do
Begin
SetArrayLength(MouseMoveMent, GetArrayLength(MouseMoveMent)+1);
SetArrayLength(MouseClick, GetArrayLength(MouseClick)+1);
SetArrayLength(KeyPress, GetArrayLength(KeyPress)+1);
SetArrayLength(WhatKey, GetArrayLength(WhatKey)+1);

GetMousePos(X, Y);

MouseMoveMent[GetArrayLength(MouseMoveMent)-1].X := X;
MouseMoveMent[GetArrayLength(MouseMoveMent)-1].Y := Y;

If(IsMouseButtonDown(True))Then
If((GetSystemTime - SysWait)>300)Then
Begin
MouseClick[GetArrayLength(MouseClick)-1] := True;
SysWait := GetSystemTime;
End;


If(IsAnyKeyDown)Then
If((GetSystemTime - SysWait)>200)Then
Begin
KeyPress[GetArrayLength(KeyPress)-1]:= True;
WhatKey[GetArrayLength(WhatKey)-1] := WhatKeyIsDown;
//Writeln('Does not work yet ;)');
SysWait := GetSystemTime;
End;

Wait(1); //Not to freeze it, And give some delay and randomness to the movement.
End;
End;

Procedure MoveByRecord;
Var
I: Integer;
Begin
For I:= 0 To GetArrayLength(MouseMoveMent)-1 Do
Begin
Status('Current Frame: ' + IntToStr(I) + '/'+ IntToStr(GetArrayLength(MouseMoveMent)-1));
MoveMouse(MouseMoveMent[I].X, MouseMoveMent[I].Y);
If(MouseClick[I])Then
ClickMouse( MouseMoveMent[I].X, MouseMoveMent[I].Y, True );
If(KeyPress[I])Then
SendKeys(WhatKey[I]);
Wait(1);
End;
End;

Var
Current: Integer;

Begin
RecordMouse;
If(RepeatMouseMoveMent)Then
Repeat
MoveByRecord;
Current := Current + 1;
Until(Times < Current)
Else MoveByRecord;
End.

Gala

2007-10-09 13:00:07

nice work :D

JuKKa

2007-10-09 13:22:53

oh i forgot to say this is big bannage in rs.

osmm

2007-10-09 17:01:20

lol, i think u should edit ur first post and make this more visible…"this is bannage in rs" but yea ill look at ur script.

Lokito

2007-10-09 17:29:23

How fast is too fast?

bink830

2007-10-09 21:59:26

yea this is a nice fun random script…
i used in notepad so i could be safe but i got so it would wait till i got my dad in the room and convinced him that my computer was haunted
thanks for the laugh =D

Dumpin

2007-10-10 11:58:07

lol ownage.. .but does scar dissapear? so you can install on any pc

R0b0t1

2007-10-10 16:46:02

SCAR is an interpreter, not a compiler. So, no. ^


Wait… You know that that many "OR"s are wasteful, yes?

q3ick

2007-10-10 20:34:31

thats cool! your scripts are awesome i still think you should make a varrock east miner :P