FrÕzÑ_§ÕµL
2008-02-18 23:10:43
OK, so you all know I hate how the SRL SendKeys2 makes a random chr(250) yea? I mean pfft when does someone add a greek symbol or an l when they are ment to type an s?! So, I finally found an awesome way to get around my old 300+ lines of code hehe, all thanks to the idea of QwertyKeys. What it does is numbers the keys on a keyboard according to qwerty. so q is 1, w is 2 and m is 26.
QwertKeys(5) would return a t as that is 5th on a keyboard.
Yea yea, shut up with your crap frozen, wtf is wrong with chr?! Well, the whole thing of typing is a key press needs to be near the original. So I use
Insert(QwertyKeys(RandomRange(k - 2, k + 2)), Text, i);
So it inserts a key into the text, after a 90% chance of deleting the original, that is up to 2 keys each way of the original one.
So if it was 't' that was typed, QwertyKeys will return any of the following values: e, r, t, y, u.
^^ Getting somewhere now? OK, so here is my final code :
The use of this would be
QwertKeys(5) would return a t as that is 5th on a keyboard.
Yea yea, shut up with your crap frozen, wtf is wrong with chr?! Well, the whole thing of typing is a key press needs to be near the original. So I use
Insert(QwertyKeys(RandomRange(k - 2, k + 2)), Text, i);
So it inserts a key into the text, after a 90% chance of deleting the original, that is up to 2 keys each way of the original one.
So if it was 't' that was typed, QwertyKeys will return any of the following values: e, r, t, y, u.
^^ Getting somewhere now? OK, so here is my final code :
{*************************************************************************************************
Function QwertyKeys(Key : Integer) : String;
By: FrÕzÑ_§ÕµL.
Description: Orders CHR keycodes by qwerty. i.e. QwertyKeys(2) returns w.
*************************************************************************************************}
Function QwertyKeys(Key : Integer) : String;
Begin
Case Key of
1 : Result := CHR(113);
2 : Result := CHR(119);
3 : Result := CHR(101);
4 : Result := CHR(114);
5 : Result := CHR(116);
6 : Result := CHR(121);
7 : Result := CHR(117);
8 : Result := CHR(105);
9 : Result := CHR(111);
10 : Result := CHR(112);
11 : Result := CHR(97);
12 : Result := CHR(115);
13 : Result := CHR(100);
14 : Result := CHR(102);
15 : Result := CHR(103);
16 : Result := CHR(104);
17 : Result := CHR(106);
18 : Result := CHR(107);
19 : Result := CHR(108);
20 : Result := CHR(122);
21 : Result := CHR(120);
22 : Result := CHR(99);
23 : Result := CHR(118);
24 : Result := CHR(98);
25 : Result := CHR(110);
26 : Result := CHR(109);
end;
end;
{*************************************************************************************************
Function TypeSend2(Text: String; PercentPerfect, PercentMistake, MaxMistakes: Integer): Boolean;
By: FrÕzÑ_§ÕµL.
Description: Types Text Human-like, pressing random keys around the original. Results True if a
mistake is made.
*************************************************************************************************}
Function TypeSend2(Text: String; PercentPerfect, PercentMistake, MaxMistakes: Integer): Boolean;
var
i, k, NumMistakes : Integer;
s : String;
Begin
Text := Trim(Lowercase(Text));
if Random(101) >= PercentPerfect then
Begin
for i := 1 to Length(Text) do
Begin
if NumMistakes >= MaxMistakes + Random(2) then
Break;
if Random(101) <= PercentMistake then
Begin
Inc(NumMistakes);
Result := true;
s := Copy(Text, i, 1);
for k := 1 to 26 do
if s = Chr(96 + k) then
Begin
if Random(101) > 10 then
Delete(Text, i, 1);
Insert(QwertyKeys(RandomRange(k - 2, k + 2)), Text, i);
end;
i := i + randomrange(2, 5);
end;
end;
end;
Typesend(Text);
end;The use of this would be
TypeSend2('lol', 33, 10, 5);