Autor Beitrag
anno2007
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: Mi 19.12.07 20:21 
Hi,
ich will ein Programm schreiben, das ein Edit-Feld besitzt.
In dieses Edit-Feld will ich eine Zahl rein schreiben, z.B 5.
Nachdem die Zahl 5 eingegeben wurde soll eine Datei, z.B. Batch datei 5 mal geöffnet werden.
Ich brauche nur jemanden der mir sagt, wie ich eine Schleife schreiben muss, sodass sie sich sooft wiederholt, wie die Zahl im Edit-Feld groß ist. Danke schonmal!

anno2007
PeterPain
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: Mi 19.12.07 20:23 
ausblenden Delphi-Quelltext
1:
 for i := 0 to StrToInt(MyEdit.Text) - 1 do					
anno2007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: Mi 19.12.07 20:34 
Danke,
aber das hab ich auch schon probiert, und bei mir klappt das irgendwie nicht. Es passiert gar nix.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Button1Click(Sender: TObject);
var i : integer;
begin
for i := 0 to StrToInt(Edit1.Text) - 1 do
ShellExecute(Handle,nil,'C:\Dokumente und Einstellungen\********\Desktop\test.bat',nil,nil,0);
end;


end.


Ich bin einfach zu dumm dafür, kann mir villeicht noch jemand helfen? Danke,
anno2007
PeterPain
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: Mi 19.12.07 20:36 
command sollte 'open' sein, oder was auch immer du vorhast... nil aber keinnesfalls ;)

gruss
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 19.12.07 20:37 
Die Parameter von ShellExecute sehen falsch aus. Einfach mal im Forum suchen ( Suche in der Entwickler-Ecke SHELLEXECUTE ), es sollte so ca. 3 Trillionen Beiträge geben, in denen die richtigen Parameter stehen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
anno2007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: Mi 19.12.07 20:46 
Cool, ihr hattet recht, es war ein Fehler mit shellexecute:

ausblenden Delphi-Quelltext
1:
ShellExecute(Handle, nil, PChar('C:\Dokumente und Einstellungen\Arno\Desktop\test.bat'), nilnil, SW_SHOW);					


so hats geklappt,

Danke!!!
anno2007