Problem with if-condition and while loop
'Ello.
Code:
program AutoTyper;
var Speed: integer;
var Output: string;
begin
Speed := 10; //Time between two outputs is calculated as Speed * 100 * Length(Output) / 10
Output := 'This is a test!' + chr(13);
while(true) do
begin
if IsFunctionKeyDown(0) then
while(true) do
begin
SendKeysWait(Output, 50, 10);
Wait(Speed * 100 * Length(Output) / 10);
if IsFunctionKeyDown(0) then
break;
end;
end;
end.
Problem is in inner loop, with break. Without break it repeatedly writes text as I want, but if I am using that break then it is working even if no Shift key is down anymore...
It is my first script in SCAR and Pascal so don't be too evil.
Please recommend workarounds or give some ideas about how to do it correctly.
"Life and Death are partners, not enemys."
By Repentinus