Frozenfire216
09-18-2012, 03:45 AM
So this is my first script, a very simple autotyper.
program Auto_Typer;
{$i srl/srl.simba}
{$I SPS/SPS.Simba}
{$IFDEF SIMBAMAJOR980}
{$ENDIF}
Const
MESSAGE_TO_TYPE=('samplemessage');
procedure TypeThis(Text:string; PressEnter:Boolean);
var
I: Integer;
begin
for i := 1 to Length(Text) do
begin
{$IFDEF SIMBAMAJOR980}
SendKeys(Text[i], 2);
{$ELSE}
SendKeys(Text[i], 2, 2);
{$ENDIF}
Wait(5);
end;
if (PressEnter) then
begin
TypeByte(VK_RETURN);
end;
end;
begin
ClearDebug;
SetUpSRL;
repeat
if (IsfKeyDown(6)) then
begin
wait(100)
TypeThis(MESSAGE_TO_TYPE, true)
wait(2000)
end;
until(false);
end.
what i am trying to accomplish is whenever i press f6, it types a certain line.
it works, but the problem im having is that it takes up about 50% of memory of my computers 1g memory. Is their any way to increase the performance of this code?
I figure that the infinite loop is the problem here, and I was wondering if there were any way to add event listeners, such as in Flash.
program Auto_Typer;
{$i srl/srl.simba}
{$I SPS/SPS.Simba}
{$IFDEF SIMBAMAJOR980}
{$ENDIF}
Const
MESSAGE_TO_TYPE=('samplemessage');
procedure TypeThis(Text:string; PressEnter:Boolean);
var
I: Integer;
begin
for i := 1 to Length(Text) do
begin
{$IFDEF SIMBAMAJOR980}
SendKeys(Text[i], 2);
{$ELSE}
SendKeys(Text[i], 2, 2);
{$ENDIF}
Wait(5);
end;
if (PressEnter) then
begin
TypeByte(VK_RETURN);
end;
end;
begin
ClearDebug;
SetUpSRL;
repeat
if (IsfKeyDown(6)) then
begin
wait(100)
TypeThis(MESSAGE_TO_TYPE, true)
wait(2000)
end;
until(false);
end.
what i am trying to accomplish is whenever i press f6, it types a certain line.
it works, but the problem im having is that it takes up about 50% of memory of my computers 1g memory. Is their any way to increase the performance of this code?
I figure that the infinite loop is the problem here, and I was wondering if there were any way to add event listeners, such as in Flash.