SRL Archive - Research & Development Lounge

Typing in SMART


cycrosism

2009-04-14 06:58:11

Hi everyone, I have been trying to work on a little procedure - When you click F12 a box will open and when you write something in there it will type it out in the smart menu. I have tried many ways but most have failed, could anyone help me?

ZephyrsFury

2009-04-14 07:02:32

Use ReadLn, that will ask the user to enter some text before storing that text in its result.


if (IsFKeyDown(6)) then
begin
SayText := ReadLn('What do you want to say?');
if (SayText <> '') then
begin
WriteLn('Manual Controls - Manual Talk: ' + SayText);
while (CountColor(clBlue, 6, 460, 512, 474) > 14) do
TypeByte(vk_Back);
TypeSend(SayText);
end;
end;

cycrosism

2009-04-14 07:48:41

I made a form that opens and it has a button and a space where you can enter your text. If i write in something then click the button scar closes along with SMART. Also the thing you wrote will only work when i call the procedure :(

edit - Read line causes the script to freeze for me

edit2 -


program New;
{.Include SRL/SRL.scar}
var
frmDesign: TForm;
Edit1: TEdit;
Button1: TButton;

Procedure ButtonClick(Sender: TObject);
Begin
Typesend(''+ Edit1.Text);
End;

procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 1;
frmDesign.Top := 1;
frmDesign.Width := 350;
frmDesign.Height := 75;
frmDesign.Caption := 'Message Box';
frmDesign.Color := ClWhite;
Button1 := TButton.Create(FrmDesign);
Button1.Parent := FrmDesign;
Button1.Left := 265;
Button1.Top := 10;
Button1.Height := 20;
Button1.Width := 50;
Button1.Caption := 'Send';
Button1.OnClick := @ButtonClick;
Edit1 := TEdit.Create(FrmDesign);
Edit1.Parent := FrmDesign;
Edit1.Top := 10;
Edit1.Left := 10;
Edit1.Width := 250;
Edit1.Height := 20;
end;

procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;

procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;

begin
SetupSRL;
SafeInitForm;
SafeShowFormModal;
end.

Also while the text box is open my script will come to a stand still until the box is closed.. im unsure what to do