Autor Beitrag
G-man
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Mi 25.06.03 10:04 
Hallo,
ich hatte schon einmal so eine ähnliche Frage gestellt:
wie kann ich mehrere Dateien nacheinander (parallel würde auch gehen)
mit der Indy-Komponente IdHTTP aus einem StringGrid mit einer Spalte aber mehreren Zeilen heraus downloaden?
Ein Codebeispiel wär` nett.

_________________
...To err is human, but to really foul things up requires a computer.
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: Mi 25.06.03 11:49 
Hallo,

Schau dir mal die Eigenschaft Cells beim StringGrid an.
Wenn ich dich richtig verstanden haben, stehen in den einzelnen Zeilen die URLs.
Das geht dann zum Beispiel so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Procedure TForm1.Download;
var FS: TFileStream;
      i : Integer;
Begin
 For i := 0 To StringGrid1.RowCount-1 do
  begin
   FS := TFileStream.Create('Datei', fmCreate); //den Dateinamen musst du dir aus dem URL herausfiltern.
   idHTTP1.Get(StringGrid1.Cells[0,i],FS);
   FS.Free;
   Application.ProcessMessages;
  end;
end;

_________________
If accidentally read, induce vomitting.
G-man Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Mo 21.07.03 15:18 
Das mit dem Dateinahme ist glaube ich mein Problem. Das mit dem Download etc. habe ich so gelöst
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
function http_get(slabel: TLabel; httpgo: TIDhttp; sGrid: TStringGrid): boolean;
var
source, destination: string;
FStream: TFileStream;
i : Integer;
begin
 for i:=0 to sGrid.RowCount-1 do
  begin
    source:=sGrid.Cells[0,i];
    if strRScan (Pchar(source), '/')<> nil then
    destination := strRScan (Pchar(source), '/');
    destination:= slabel.Caption +destination;
    FStream:= TFileStream.Create (destination, FmCreate);
    httpgo.Get(source, FStream);
    FStream.Free;
    Application.ProcessMessages;
  end;
end;

Aber es funzt net... Weiß jemand Rat???

_________________
...To err is human, but to really foul things up requires a computer.
G-man Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Do 24.07.03 12:48 
Ach ja, das Label gibt das Laufwerk und den Ordner an, in das die Datei reingeschrieben wird.

_________________
...To err is human, but to really foul things up requires a computer.