Autor Beitrag
DaKrissX84
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Mi 05.03.03 21:06 
Hi Leute!

Folgende Funktion soll mir dazu dienen, den Namen von HTML-Inputs z.B. vom Typen "Password" auszulesen.
"Bezeichnung" wäre in diesem Fall 'type="password"'
Dazu wird der gesamte Quelltext per IdHTTP ausgelesen. Dann wird ein 100 Stellen großes Stück, in welchem sich auf jeden Fall "Bezeichnung" befindet in "Name" gespeichert.
An "Name" wird dann so lange per Delete() herumgeschnitten, bis eigentlich in "Name" der Tatsächliche Name des Inputs stehen müsste.

Naja, das Problem:
Es funktioniert natürlich nicht wie es soll, und liefert manchmal sogar strings, die überhaupt gar nicht im quelltext zu finden sind...!!
WARUM??

Ich hoffe, mir kann jemand helfen. Danke schomma!

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
function GetPasswordName(idhttp:TidHttp ;Bezeichnung:String):string;
var
a,i,stelle:integer;
name,text:string;
begin
text:=idhttp.Get(adresse);
stelle:=pos(Bezeichnung,text)-50;
for i:=0 to 100 do
        begin
        name:=name+text[stelle+i];
        end;
delete(name,1,pos('name="',name)-1);
delete(name,pos('name="',name),6);
a:=length(name)-pos('"',name);
delete(name,pos('"',name),a);
result:=name;
end;
DaKrissX84 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Do 06.03.03 17:19 
Gut.

Verstehe schon, warum mir keiner helfen kann....

da ich ja Anfänger bin, habe ich warscheinlich die kompliziert-möglichste und umständlichste Methode gewählt, die es gibt... :?

Also frage ich nochmal und diesmal ganz neutral:

Wie kann man die Namen von Inputs (also z.B. Eingabefeldern, oder Buttons) einer Internetseite auslesen??

Das muss doch einer wissen....!?

bitte helft mir!

heissen dank!

Kriss
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Do 06.03.03 17:21 
Geh mal auf Torry's Delphi Pages und schau mal, ob eine der Komponenten zu HTML dir zusagt.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
DaKrissX84 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Fr 07.03.03 15:51 
Leider nicht...

Trotzdem Danke!

Da steh ich nun ich armer Thor.... :(
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Fr 07.03.03 17:39 
Wenn dir keine Komponente zusagt, schreibe ich dir mal einen Vorschlag:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
  name := //dein Text als String
  i := 0; //counter Variable als Integer
  repeat
    neuerText := name[i] + name[i+1] + name[i+2] + name[i+3];
    Inc(i);  //neuerText: String;
  until
    neuerText = 'type';
  i := i+5;  (*falls da eine " zuviel kommt schreibe hier statt 5 6*)
  repeat
    typ := typ + name[i]; //typ: String;
    Inc(i);
  until
    name[i] = '"'; //Anführungszeichen
  //dein Typ sollte nun von dem String typ angegeben


Ich weise noch darauf hin, dass ich das auf die schnelle nicht getestet habe. Wenn Fehler kommen frag mich einfach hier.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
DaKrissX84 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Sa 08.03.03 12:31 
Vielen Dank für die Mühe!

Leider kommt folgende Fehlermeldung, die ich nicht ganz verstehe:

ausblenden Quelltext
1:
2:
3:
4:
5:
repeat 
    neuerText := name[i] + name[i+1] + name[i+2] + name[i+3]; 
    Inc(i);  //neuerText: String; 
  until 
    neuerText = 'type'; //<---- diese Zeile wird markiert.


Fehlermeldung:
Inkompatible Typen: 'String' und 'procedure, untyped pointer or untyped parameter'

PS:
Eigentlich wollte ich ja den NAMEN des Inputs auslesen. Gibt mir dein Code nicht den "Typ" an? (Kann ich natürlich entsprechend ändern, aber ich wollte lieber nochmal fragen)

Thanx
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Sa 08.03.03 15:31 
Ja dann ändere einfach den String in 'name' und ändere die Bezeichnung des Strings name in nameStr.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
DaKrissX84 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Mo 10.03.03 14:45 
Komisch....

Habs jetzt geändert, bekomme aber immer einen Ellenlangen Text geliefert....!?

WARUM?

Gruß
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 10.03.03 15:35 
Teste mal eine kurze html Seite mit Input und schreibe diese mal hierher. Dann gib mal an, was er dir rausholt. Ich glaube das müsste helfen.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
DaKrissX84 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Mo 10.03.03 20:30 
JUHUUU! Es geht!

DerDoc: Dein Code funktioniert wunderbar. Habs jetzt endlich hingekriegt. Vielen Dank!! :D
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 10.03.03 20:32 
Ich helfe doch gerne. :)

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.