Harled
2007-10-02 12:52:45
This script can be used to control your mouse with keyboard. Use arrow keys to move cursor and L and R to click.
L = left.
R = right.
Have fun and PLEASE POST SOME FEEDBACK :( :( :( :fiery:
L = left.
R = right.
Have fun and PLEASE POST SOME FEEDBACK :( :( :( :fiery:
// KeyMouse
// Script allows you to control your mouse with your keyboard.
// Move mouse with arrow keys, R to right click and L to left click.
// Seemed like a cool idea so i made it. A simple script.
// History: fixed bug so mouse can't get stuck cause of too big or small coordinates.
// made by Harled
program KeyMouse;
const
SleepTime = 10; // sleep time, no need touching.
JumpPix = 10; // Speed of mouse? I recommend 3-10
version = '0.5';
var
Dimensions, Temp: TPoint; // TPoints.
x, y, Thepixel, Ac: Integer; // Coordinates..
procedure DetectClicks;
var
Charset: array [0..1] of array [1..2] of Char; // multidimensional array
Options: array [0..1] of Boolean;
I: Integer;
begin
Charset[0][1] := 'l';
Charset[0][2] := 'L';
Charset[1][1] := 'r';
Charset[1][2] := 'R';
Options[0] := True;
Options[1] := False;
for I := 0 to 1 do
begin
if IsKeyDown(Charset[I][1]) or
IsKeyDown(Charset[I][2]) then
begin
GetMousePos(Temp.X, Temp.Y);
ClickMouse(Temp.X, Temp.Y, Options[I]);
end;
end;
end;
procedure ChangeCoords(WhatArrow: Integer);
begin
case WhatArrow of
0: if not (Y - JumpPix < 0) then Y := Y - JumpPix;
1: if not (X + JumpPix > Dimensions.X) then X := X + JumpPix;
2: if not (Y + JumpPix > Dimensions.Y) then Y := Y + JumpPix;
3: if not (X - JumpPix < 0) then X := X - JumpPix;
end;
end;
procedure CheckSimilars(WhatKey: Integer);
var
SimStr, TChar: string;
CS, TheNum: Integer;
begin
case WhatKey of
0: SimStr := '3,1';
1: SimStr := '0,1';
2: SimStr := '1,3';
3: SimStr := '1,0';
end;
for CS := 1 to 3 do
begin
TChar := '';
TChar := SimStr[CS];
try // theres the , there too.
TheNum := StrToInt(TChar);
if IsArrowDown(TheNum) then
begin
ChangeCoords(TheNum);
Break;
end;
except
Wait(10);
end;
end;
ChangeCoords(WhatKey);
end;
begin
GetClientDimensions(Dimensions.X, Dimensions.Y); // setup kind of stuff.
x := Dimensions.X div 2;
y := Dimensions.Y div 2;
MoveMouseSmooth(x, y);
Wait(1000);
repeat
Wait(35); // so the CPU wont burn
for Ac := 0 to 3 do
begin
Wait(SleepTime);
if IsArrowDown(Ac) then
begin
CheckSimilars(Ac);
MoveMouseSmooth(x, y);
ClearDebug;
Writeln('Moved mouse to: '+IntToStr(x)+','+IntToStr(y));
Writeln('Color at the coordinate is: '+IntToStr(GetColor(x, y)));
end;
DetectClicks;
end;
until(false);
end.