Had to look at the code for SleepAndMoveMouse for a function I was making. Just saw that it could be shortened a few lines so I thought I'd post:


SCAR Code:
procedure SleepAndMoveMouse(Time: Integer);
var
  Moving: Boolean;
  mx, my: Integer;
  x, y, xv, yv: Extended;
  gx, gy: Extended;
  T: Integer;
begin
  GetMousePos(mx, my);
  x := mx;
  y := my;
  if (Random(2) = 0) then
    Moving := False
  else
    Moving := True;
  gx := 130 + Random(500);
  gy := 130 + Random(300);
  T := GetTickCount;
  repeat
    Sleep(10);
    if (Moving) then
    begin
      if (gx > x) then
        xv := xv + 0.1
      else
        xv := xv - 0.1;
      if (gy > y) then
        yv := yv + 0.1
      else
        yv := yv - 0.1;
      x := x + xv;
      y := y + yv;
      MoveMouse(Round(x), Round(y));
    end;
    if (Random(100) = 0) then
      Moving := not Moving;
    if (Random(30) = 0) then
    begin
      gx := 130 + Random(500);
      gy := 130 + Random(300);
    end;
  until (Abs(GetTickCount - T) >= Time);
end;

Change to:

SCAR Code:
procedure SleepAndMoveMousee(Time: Integer);
var
  Moving: Boolean;
  mx, my: Integer;
  x, y, xv, yv: Extended;
  gx, gy: Extended;
  T: Integer;
begin
  GetMousePos(mx, my);
  x := mx;
  y := my;
  Moving := Random(2) = 0;
  gx := 130 + Random(500);
  gy := 130 + Random(300);
  T := GetTickCount;
  repeat
    Sleep(10);
    if (Moving) then
    begin
      if (gx > x) then
        xv := xv + 0.1
      else
        xv := xv - 0.1;
      if (gy > y) then
        yv := yv + 0.1
      else
        yv := yv - 0.1;
      x := x + xv;
      y := y + yv;
      MoveMouse(Round(x), Round(y));
    end;
    if (Random(100) = 0) then
      Moving := not Moving;
    if (Random(30) = 0) then
    begin
      gx := 130 + Random(500);
      gy := 130 + Random(300);
    end;
  until (Abs(GetTickCount - T) >= Time);
end;

Would probably be unnoticeable faster for the computer to process too