SRL Archive - Research & Development Lounge

function SendKeyboard(FKey:Integer; Text:String): Integer;


Daniel

2007-07-18 07:13:47

This will send the same sentence two times. Instead of typing up all those TypeSend functions made by SRL, this will repeat that sentence when an F Key is pressed in which you specify as for the sentence too.

function SendKeyboard(FKey: Integer; Text: String): Integer;
begin
{.include SRL\SRL.scar}
if(IsFKeyDown(FKey)) then
TypeSend(Text);
Wait(1000 + Random(400));
TypeSend(Text);
Wait(769);
end;

It works :).

Lalaji

2007-07-18 07:15:25

nice for auto talkers

ZephyrsFury

2007-07-18 07:25:46

Why did you make your function return an integer. Shouldn't it be a boolean - if it was successfully typed or not? Or maybe just make it a procedure. Anyway you haven't specified what the result is (what is returned by calling this function). Also, you could add another parameter called WaitTime or something so the scripter can specify a wait time instead of 1000 + random(400).
For example:
function SendKeyboard(FKey: Integer; Text: String; WaitTime: integer): Boolean;
begin
{.include SRL\SRL.scar}
if(IsFKeyDown(FKey)) then
begin
TypeSend(Text);
Wait(WaitTime);
Result := True;
end;
end;

Daniel

2007-07-18 07:31:48

From: ZephyrsFury
Why did you make your function return an integer. Shouldn't it be a boolean - if it was successfully typed or not? Or maybe just make it a procedure. Anyway you haven't specified what the result is (what is returned by calling this function). Also, you could add another parameter called WaitTime or something so the scripter can specify a wait time instead of 1000 + random(400).
For example:
function SendKeyboard(FKey: Integer; Text: String; WaitTime: integer): Boolean;
begin
{.include SRL\SRL.scar}
if(IsFKeyDown(FKey)) then
begin
TypeSend(Text);
Wait(WaitTime);
Result := True;
end;
end;


I was thinking about adding a wait time so the user can choose but i thought. No. so i didn't.

And i was deciding whether a Boolean or an Integer but i just went with Integer as i didn't really much understand Booleans. Now i do, thanks :).

rotflmfwao

2007-07-18 12:28:33

Boolean is just true or false. BTW, your original function didn't include a
Result:=something
which makes it pretty much a procedure…
Zephyr's is better XD no offense, it was a good 1st try.