1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| function ConstructorBatch(Batch: TMemo): String;
const
Sub = '&&';
var
I: Integer;
Cmd: String;
begin
Result := '';
for I := 0 to Batch.Lines.Count - 1 do
begin
Cmd := Cmd + Batch.Lines.Strings[I] + Sub;
end;
Result := Copy(Cmd,0, Length(Cmd) -2);
end;
procedure TForm1.btn_ExecuterClick(Sender: TObject);
Var aCmdLine : PChar;
begin
aCmdLine := PChar(cmdSwitch + ConstructorBatch(Batch));
StatusBar1.SimpleText := aCmdLine;
Case cb_FenetreDos.Checked of
True :ShellExecute(Handle, nil, 'CMD', aCmdLine, nil, sw_ShowNormal);
False :ShellExecute(Handle, nil, 'CMD', aCmdLine, nil, sw_Hide);
end;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
CmdSwitch := CmdSwitchs[TRadioButton(Sender).tag] ;
if RadioButton2.Checked Then
With cb_FenetreDos do
Begin
Checked := True;
Enabled := False;
End
Else cb_FenetreDos.Enabled := True;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
RadioButton2.Checked := True;
end; |
Partager