putonajonny
2012-04-24 10:53:54
Same as TypeSendEx but makes mistakes then corrects itself, just more human like
Try running it on something like this:
It uses this function to get a key nearby the one it is supposed to press
You'll also need this function:
procedure TypeSendMistakeEx(Text: string; PressEnter: Boolean);
var
i, j, R : Integer;
begin
for i := 1 to Length(Text) do
begin
Case Random(30) of //1 in 30 chance of hitting wrong key
0 : begin
SendKeys(NearbyKey(Text[i]), 40 + Random(40)); //Types a nearby key
Wait(40 + Random(40));
R := Random(4);
for j := 1 to R do //for up to 4 keys more
if(Length(Text) >= i + R)then //checks that that wont be the past the end of the String
begin
SendKeys(Text[i + j], 40 + Random(40)); //Types the next key and then waits
Wait(40 + Random(40));
end
else
begin
R := j - 1;
break
end;
Wait(100+Random(100));
for j := 0 to R do
begin
TypeByte(VK_BACK); //Backspaces to just before the incorrect key
Wait(40+Random(40));
end;
Wait(100+Random(100));
SendKeys(Text[i], 40 + Random(40)); //Types the correct key
Wait(50+Random(50));
end; //And continues
else
SendKeys(Text[i], 40 + Random(40));
end;
Wait(40 + Random(40));
end;
if (PressEnter) then
TypeByte(VK_RETURN);
end;Try running it on something like this:
TypeSendMistakeEx('Simba is a program designed to perform repetitive tasks such as mouse movements, keyboard strokes and complicated sequence of events. Simba is controlled through user created scripts written in the PASCAL language. Simba uses advanced techniques such as OCR, Bitmap and DTM recognition to gather information about its environment.', True);It uses this function to get a key nearby the one it is supposed to press
Function NearbyKey(Key : String) : String;
Var
Keys, Nearby : array of String;
P : integer;
begin
Keys := ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 'q', 'w', 'e', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 'a', 's', 'd', 'f', 'g', 'h', 'k', 'l', ';', '''', '#', '\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', '!', '"', '$', '%', '^', '&', '*', '(', ')', '_', '+', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '@', '~', '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', ' '];
Nearby := ['q2w', '1w3qe', '2e4wr', '3r5et', '4t6ry', '5y7tu', '6u8yi', '7i9uo', '8o0ip', '9p-o[', '0[=p]', '-][', '1aw2s', '2qse13ad', '3wdr24sf', '5rgy46fh', '6thu57gj', '7yji68hk', '8uko79jl', '9ilp80k;', '0o;[9-l''', '-p'']0=;#', '=[#-''', 'q\swz', 'wazdqe\x', 'esxfwrzc', 'rdcgetxv', 'tfvhrycb', 'ygbjtuvn', 'ijmluon,', 'ok,;ipm.', 'pl.''o[,/', '[;/#p].', ']''[/', 'a zs ', 's\ xad', 'dz csf', 'fx vdg', 'gc bfh', 'hv ngj', 'jb mhk', 'kn ,jl', 'lm .k;', ';, /l''', '''. ;#', 'Q"W', '!WQE', 'R%ET', '$T^RY', '%Y&TU', '^U*YI', '&I(UO', '*O)IP', '(P_O{', '){+P}', '_}{', '!AW"S', '"QSE!AD', 'WDR"$SF', '$EFT%DG', '%RGY$^FH', '^THU%&GJ', '&YJI^*HK', '*UKO&(JL', '(ILP*)K:', ')O:{(_L@', '_P@})+:~', '+{~_@', 'Q|SWZ', 'WAZDQE|X', 'ESXFWRZC', 'RDCGETXV', 'TFVHRYCB', 'YGBJTUVN', 'UHNKYIBM', 'IJMLUON<', 'OK<:IPM>', 'PL>@O{<?', '{:?~P}>', '}@{?', 'A ZS', 'S| XAD', 'DZ CSF', 'FX VDG', 'GC BFH', 'HV NGJ', 'JB MHK', 'KN <JL', 'LM >K:', ':< ?L@', '@> :~', 'cvbnm,'];
if(InStrArrExCase(Key, Keys, True, P))then
Result := Nearby[P][1 + Random(Length(Nearby[P]))];
end;You'll also need this function:
function InStrArrExCase(S: string; StrArr: TStringArray; CaseSensetive : Boolean; var Where: Integer): Boolean;
var //by n3ss3s but edited slightly by me
i, H : Integer;
begin
H := High(StrArr);
if(CaseSensetive)then
begin
for i := 0 to H do
if StrArr[i] = S then
begin
Where := i;
Result := True;
exit;
end;
end
else
begin
for i := 0 to H do
if LowerCase(StrArr[i]) = LowerCase(S) then
begin
Where := i;
Result := True;
exit;
end;
end;
end;Function NearbyKey(Key : String) : String;
Var
Keys : array of String;
begin
Case Key of
'1' : Keys := ['q', '2', 'w']; //I wrote some code to generate this, so I am sorry if there are mistakes, It takes up lots of space so is there a way to compress this?
'2' : Keys := ['1', 'w', '3', 'q', 'e'];
'3' : Keys := ['2', 'e', '4', 'w', 'r'];
'4' : Keys := ['3', 'r', '5', 'e', 't'];
'5' : Keys := ['4', 't', '6', 'r', 'y'];
'6' : Keys := ['5', 'y', '7', 't', 'u'];
'7' : Keys := ['6', 'u', '8', 'y', 'i'];
'8' : Keys := ['7', 'i', '9', 'u', 'o'];
'9' : Keys := ['8', 'o', '0', 'i', 'p'];
'0' : Keys := ['9', 'p', '-', 'o', '['];
'-' : Keys := ['0', '[', '=', 'p', ']'];
'=' : Keys := ['-', ']', '['];
'q' : Keys := ['1', 'a', 'w', '2', 's'];
'w' : Keys := ['2', 'q', 's', 'e', '1', '3', 'a', 'd'];
'e' : Keys := ['3', 'w', 'd', 'r', '2', '4', 's', 'f'];
'r' : Keys := ['4', 'e', 'f', 't', '3', '5', 'd', 'g'];
't' : Keys := ['5', 'r', 'g', 'y', '4', '6', 'f', 'h'];
'y' : Keys := ['6', 't', 'h', 'u', '5', '7', 'g', 'j'];
'u' : Keys := ['7', 'y', 'j', 'i', '6', '8', 'h', 'k'];
'i' : Keys := ['8', 'u', 'k', 'o', '7', '9', 'j', 'l'];
'o' : Keys := ['9', 'i', 'l', 'p', '8', '0', 'k', ';'];
'p' : Keys := ['0', 'o', ';', '[', '9', '-', 'l', #39];
'[' : Keys := ['-', 'p', #39, ']', '0', '=', ';', '#'];
']' : Keys := ['=', '[', '#', '-', #39];
'a' : Keys := ['q', '\', 's', 'w', 'z'];
's' : Keys := ['w', 'a', 'z', 'd', 'q', 'e', '\', 'x'];
'd' : Keys := ['e', 's', 'x', 'f', 'w', 'r', 'z', 'c'];
'f' : Keys := ['r', 'd', 'c', 'g', 'e', 't', 'x', 'v'];
'g' : Keys := ['t', 'f', 'v', 'h', 'r', 'y', 'c', 'b'];
'h' : Keys := ['y', 'g', 'b', 'j', 't', 'u', 'v', 'n'];
'j' : Keys := ['u', 'h', 'n', 'k', 'y', 'i', 'b', 'm'];
'k' : Keys := ['i', 'j', 'm', 'l', 'u', 'o', 'n', ','];
'l' : Keys := ['o', 'k', ',', ';', 'i', 'p', 'm', '.'];
';' : Keys := ['p', 'l', '.', #39, 'o', '[', ',', '/'];
#39 : Keys := ['[', ';', '/', '#', 'p', ']', '.'];
'#' : Keys := [']', #39, '[', '/'];
'\' : Keys := ['a', ' ', 'z', 's', ' '];
'z' : Keys := ['s', '\', ' ', 'x', 'a', 'd'];
'x' : Keys := ['d', 'z', ' ', 'c', 's', 'f'];
'c' : Keys := ['f', 'x', ' ', 'v', 'd', 'g'];
'v' : Keys := ['g', 'c', ' ', 'b', 'f', 'h'];
'b' : Keys := ['h', 'v', ' ', 'n', 'g', 'j'];
'n' : Keys := ['j', 'b', ' ', 'm', 'h', 'k'];
'm' : Keys := ['k', 'n', ' ', ',', 'j', 'l'];
',' : Keys := ['l', 'm', ' ', '.', 'k', ';'];
'.' : Keys := [';', ',', ' ', '/', 'l', #39];
'/' : Keys := [#39, '.', ' ', ';', '#'];
' ' : Keys := ['c', 'v', 'b', 'n', 'm', ','];
'!' : Keys := ['Q', '"', 'W'];
'"' : Keys := ['!', 'W', 'Q', 'E'];
'$' : Keys := ['R', '%', 'E', 'T'];
'%' : Keys := ['$', 'T', '^', 'R', 'Y'];
'^' : Keys := ['%', 'Y', '&', 'T', 'U'];
'&' : Keys := ['^', 'U', '*', 'Y', 'I'];
'*' : Keys := ['&', 'I', '(', 'U', 'O'];
'(' : Keys := ['*', 'O', ')', 'I', 'P'];
')' : Keys := ['(', 'P', '_', 'O', '{'];
'_' : Keys := [')', '{', '+', 'P', '}'];
'+' : Keys := ['_', '}', '{'];
'Q' : Keys := ['!', 'A', 'W', '"', 'S'];
'W' : Keys := ['"', 'Q', 'S', 'E', '!', 'A', 'D'];
'E' : Keys := ['W', 'D', 'R', '"', '$', 'S', 'F'];
'R' : Keys := ['$', 'E', 'F', 'T', '%', 'D', 'G'];
'T' : Keys := ['%', 'R', 'G', 'Y', '$', '^', 'F', 'H'];
'Y' : Keys := ['^', 'T', 'H', 'U', '%', '&', 'G', 'J'];
'U' : Keys := ['&', 'Y', 'J', 'I', '^', '*', 'H', 'K'];
'I' : Keys := ['*', 'U', 'K', 'O', '&', '(', 'J', 'L'];
'O' : Keys := ['(', 'I', 'L', 'P', '*', ')', 'K', ':'];
'P' : Keys := [')', 'O', ':', '{', '(', '_', 'L', '@'];
'{' : Keys := ['_', 'P', '@', '}', ')', '+', ':', '~'];
'}' : Keys := ['+', '{', '~', '_', '@'];
'A' : Keys := ['Q', '|', 'S', 'W', 'Z'];
'S' : Keys := ['W', 'A', 'Z', 'D', 'Q', 'E', '|', 'X'];
'D' : Keys := ['E', 'S', 'X', 'F', 'W', 'R', 'Z', 'C'];
'F' : Keys := ['R', 'D', 'C', 'G', 'E', 'T', 'X', 'V'];
'G' : Keys := ['T', 'F', 'V', 'H', 'R', 'Y', 'C', 'B'];
'H' : Keys := ['Y', 'G', 'B', 'J', 'T', 'U', 'V', 'N'];
'J' : Keys := ['U', 'H', 'N', 'K', 'Y', 'I', 'B', 'M'];
'K' : Keys := ['I', 'J', 'M', 'L', 'U', 'O', 'N', '<'];
'L' : Keys := ['O', 'K', '<', ':', 'I', 'P', 'M', '>'];
':' : Keys := ['P', 'L', '>', '@', 'O', '{', '<', '?'];
'@' : Keys := ['{', ':', '?', '~', 'P', '}', '>'];
'~' : Keys := ['}', '@', '{', '?'];
'|' : Keys := ['A', ' ', 'Z', 'S'];
'Z' : Keys := ['S', '|', ' ', 'X', 'A', 'D'];
'X' : Keys := ['D', 'Z', ' ', 'C', 'S', 'F'];
'C' : Keys := ['F', 'X', ' ', 'V', 'D', 'G'];
'V' : Keys := ['G', 'C', ' ', 'B', 'F', 'H'];
'B' : Keys := ['H', 'V', ' ', 'N', 'G', 'J'];
'N' : Keys := ['J', 'B', ' ', 'M', 'H', 'K'];
'M' : Keys := ['K', 'N', ' ', '<', 'J', 'L'];
'<' : Keys := ['L', 'M', ' ', '>', 'K', ':'];
'>' : Keys := [':', '<', ' ', '?', 'L', '@'];
'?' : Keys := ['@', '>', ' ', ':', '~'];
else
begin
Result := Key;
exit;
end;
end;
Result := Keys[Random(GetArrayLength(Keys))];
end;