Autor Beitrag
fabi65
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 20:28 
hallo,
ich habe eine TXT in der vollgendes steht:
ausblenden Quelltext
1:
Name&&link&&					



jetzt möchte ich das ganze in einer listbox ausgeben und wenn man darauf klickt den link im inet geöffnet bekommen. Ich bin ein ziemlicher noob in Delphi, wäre aber für Hilfe dankbar :D

Edit: Die txt soll aus dem inet ausgelesen werden: www.test.de/test.txt sowas halt...
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 20:34 
ausblenden Delphi-Quelltext
1:
listbox1.items.loadfromfile(FILE);					


sollte gehen (habe es aus kopf geschrieben) wenn nicht nochmal meden

und herzlich willkomen im delphiforum!

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.


Zuletzt bearbeitet von Harry M. am Di 29.03.05 20:44, insgesamt 3-mal bearbeitet
fabi65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 20:37 
muss ich da noch eine unit einfügen? und wie bekomme ich hin das da nur der Name drinsteht? und das ein link drauf ist.....
fabi65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 20:42 
ok geht, nur steht der gesamte inhalt der txt da drin..... :(
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 20:44 
naja wolltest doch oder habe ich da was falsch verstanden
ps: das andere geht nicht ich kuck abermal... sorry

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
fabi65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 20:46 
also ich halt den namen aus der txt ausgeben lassen, und daruaf soll dann ein link sein...
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 20:50 
war mal kurz im "labor": so gehts
ausblenden Delphi-Quelltext
1:
2:
3:
uses shellapi
//...
ShellExecute(Application.Handle, 'open', PChar(Listbox1.Items.Strings[listbox1.ItemIndex]), nil, nil, sw_ShowNormal)


na du hast eine liste mit links:
www.blabla.de
www.schnulli.de
www.hokuspokus.de
usw.

diese in eine listbox laden:
ausblenden Delphi-Quelltext
1:
Listbox1.items.loadsfromfile('Links.txt');					

und in das onclickereignis der listbox den code ^^^ einfügen dann sollte es gehen

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 29.03.05 20:57 
Ich glaub sein Hauptproblem ist, dass er alles links vom && als Text und das rechts davon als eigentliche URL haben will. ;)
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 21:01 
du meinst ne splittung des textes? in text und url?

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
fabi65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 21:02 
jup
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 21:05 

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 21:17 
ich habe das mal für dich gemacht

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.ListBox1Click(Sender: TObject);
Var
  s, s1, s2, s3: String;
begin
 S := Listbox1.Items.Strings[listbox1.ItemIndex];
 s1 := Copy(s, 1, Pos(' ', s) - 1);
  Delete(s, 1, Pos('/', s));
  s := Trim(s);

  s2 := Copy(s, 1, Pos('/', s) - 1);
  Delete(s, 1, Pos('/', s));

  s3 := s;

  ShellExecute(Application.Handle, 'open', PChar(s3), nil, nil, sw_ShowNormal)
end;

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
fabi65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 21:37 
danke ,aber ich bin ein ziemlicher noob.... wo ich jetzt den dateinamen angeben? und muss ich sonst noch was angeben?
fabi65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 21:43 
hab das jetzt so gemacht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
procedure TForm9.ListBox1Click(Sender: TObject);
Var
  s, s1, s2, s3: String;

begin
    listbox1.items.loadfromfile('C:\lol.txt');
  S := Listbox1.Items.Strings[listbox1.ItemIndex];
 s1 := Copy(s, 1, Pos(' ', s) - 1);
  Delete(s, 1, Pos('/', s));
  s := Trim(s);


  s2 := Copy(s, 1, Pos('/', s) - 1);
  Delete(s, 1, Pos('/', s));


  s3 := s;

 
  ShellExecute(Application.Handle, 'open', PChar(s3), nil, nil, sw_ShowNormal)

end;

end.

geht aber nett..... was mach ich falsch?


Zuletzt bearbeitet von fabi65 am Di 29.03.05 21:55, insgesamt 1-mal bearbeitet
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 21:45 
ich lese immer viel zu schnell:
schnip schnap warte mal...

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.


Zuletzt bearbeitet von Harry M. am Di 29.03.05 21:57, insgesamt 3-mal bearbeitet
fabi65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 21:46 
ausblenden volle Höhe Delphi-Quelltext
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:
43:
44:
45:
46:
47:
48:
49:
50:
unit Unit9;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, shellapi;

type
  TForm9 = class(TForm)
    ListBox1: TListBox;
    procedure ListBox1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form9: TForm9;

implementation

{$R *.dfm}

procedure TForm9.ListBox1Click(Sender: TObject);
Var
  s, s1, s2, s3: String;

begin
    listbox1.items.loadfromfile('C:\lol.txt');

  S := Listbox1.Items.Strings[listbox1.ItemIndex];
 s1 := Copy(s, 1, Pos(' ', s) - 1);
  Delete(s, 1, Pos('/', s));
  s := Trim(s);


  s2 := Copy(s, 1, Pos('/', s) - 1);
  Delete(s, 1, Pos('/', s));


  s3 := s;

 
  ShellExecute(Application.Handle, 'open', PChar(s3), nil, nil, sw_ShowNormal)

end;

end.


Zuletzt bearbeitet von fabi65 am Di 29.03.05 21:53, insgesamt 1-mal bearbeitet
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 29.03.05 21:47 
Eieiei... :D Bau mal bitte in deine letzten beiden Beiträge immer Delphi-Tags rein. ;) Danke. ;)
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 21:54 
legste dir noch nen button auf die form und nen opendialog!

ausblenden volle Höhe Delphi-Quelltext
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:
43:
44:
45:
46:
47:
48:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, shellapi;

type
  TForm1 = class(TForm)
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    ListBox1: TListBox;
    procedure Button1Click(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 if opendialog1.execute then listbox1.items.loadfromfile(opendialog1.filename);
end;

procedure TForm1.ListBox1Click(Sender: TObject);
Var
  s, s1, s2, s3: String;
begin
      S := Listbox1.Items.Strings[listbox1.ItemIndex];
    s1 := Copy(s, 1, Pos(' ', s) - 1);
    Delete(s, 1, Pos('/', s));
    s := Trim(s);
    s2 := Copy(s, 1, Pos('/', s) - 1);
    Delete(s, 1, Pos('/', s));
    s3 := s;
  ShellExecute(Application.Handle, 'open', PChar(s3), nil, nil, sw_ShowNormal)
end;

end.


nun sollte es doch gehen
@WeBsPaCe: übste schon mal den mod *g

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
fabi65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 29.03.05 22:01 
opendialog???
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 29.03.05 22:03 
quäl bitte deine delphi-hilfe-suchfunktion und nicht mich :lol:

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.