Autor Beitrag
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 25.12.05 21:16 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button5Click(Sender: TObject);
var 
  ovElements: OleVariant; 
  i: Integer; 
begin 
  ovElements := WebBrowser1.OleObject.Document.forms.item(0).elements; 
  for i := 0 to (ovElements.Length - 1do
    if  (ovElements.item(i).name= 'OK!'then
      ovElements.item(i).Click; 
end;


und so ?
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 25.12.05 21:23 
Hast du mit den Webbrowser auch zuvor auf die Login-Seite von freenet navigiert?
ausblenden Delphi-Quelltext
1:
webbrowser1.navigate('http://kjhdsakjsadkh.net');					


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: So 25.12.05 21:30 
ausblenden Delphi-Quelltext
1:
WebBrowser1.Navigate('http://e-tools.freenet.de/login.php3' );					


Hab ich gemacht, also er ist schon auf der Seite ....

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button5Click(Sender: TObject);
var 
  ovElements: OleVariant; 
  i: Integer; 
begin 
  ovElements := WebBrowser1.OleObject.Document.forms.item(0).elements; 
  for i := 0 to (ovElements.Length - 1do
    if  (ovElements.item(i).name= 'OK!'then
      ovElements.item(i).Click; 
end;


Auch das geht leider nicht ....

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt



Edit: Kann mir echt keiner helfen? Es kann doch nicht so schwer sein, dem TWebBrowser zu sagen, er soll auf ein Image klicken!!
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mo 26.12.05 12:56 
anscheinend doch, versuch mal nach anderen kriterien, als dem namen auszuwählen
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: Mo 26.12.05 15:36 
Hm, jetzt hab ich statt name "width" eingegeben, und den dazugehörigen Wert... (45), geht aber immer noch nicht!

Irgendwas funktioniert da nicht...

Irgendwelche Lösungsansätze?
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 26.12.05 15:45 
Probier mal das:
www.swissdelphicente...showcode.php?id=1645

ausblenden volle Höhe SwissDelphiCenter.ch Code
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:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
{
 If you have a webpage with a Form on it, but the submit - button is an image,
 you can use this code (using a TWebBrowser)
}


{
 Falls du eine Webpage mit einem Formular hast,
 bei welchem der Submit-Knopf ein Bild ist,
 dann kannst du diesen Code benutzen (sowie ein TWebBrowser)
}


uses
  MSHTML;

var
  iDoc: IHtmlDocument2;
  i: integer;
  ov: OleVariant;
  iDisp: IDispatch;
  iColl: IHTMLElementCollection;
  InputImage: HTMLInputImage;
begin
  WebBrowser1.ControlInterface.Document.QueryInterface(IHtmlDocument2, iDoc);
  if not Assigned(iDoc) then
  begin
    Exit;
  end;
  ov := 'INPUT';
  iDisp := iDoc.all.tags(ov);
  if Assigned(IDisp) then
  begin
    IDisp.QueryInterface(IHTMLElementCollection, iColl);
    if Assigned(iColl) then
    begin
      for i := 1 to iColl.Get_length do
      begin
        iDisp := iColl.item(pred(i), 0);
        iDisp.QueryInterface(HTMLInputImage, InputImage);
        if Assigned(InputImage) then
        begin
          if InputImage.Name = 'submit' then
          // if the name is submit / falls der name submit lautet
          begin
            InputImage.Click;  // click it / klick es
          end;
        end;
      end;
    end;
  end;
end;

// 2.

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Word;
  Document: IHtmlDocument2;
  str: string;
begin
  // Schleife über alle Bilder im Webbrowser
  for i := 0 to WebBrowser1.OleObject.Document.Images.Length - 1 do
  begin
    Document := WebBrowser1.Document as IHtmlDocument2;
    // URL auslesen
    Str := (Document.Images.Item(i, 0as IHTMLImgElement).Href;
    // Dateiname des Bildes überprüfen
    if Pos('submit_icon.gif', str) <> 0 then
    begin
      ((Document.Images.Item(i, 0as IHTMLImgElement) as IHTMLElement).Click;
    end;
  end;
end;


Das hervorgehobene durch den Dateinamen des OK!-Buttons ersetzen...
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: Mo 26.12.05 16:38 
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:
uses
  MSHTML;

var
  iDoc: IHtmlDocument2;
  i: integer;
  ov: OleVariant;
  iDisp: IDispatch;
  iColl: IHTMLElementCollection;
  InputImage: HTMLInputImage;
begin
  WebBrowser1.ControlInterface.Document.QueryInterface(IHtmlDocument2, iDoc);
  if not Assigned(iDoc) then
  begin
    Exit;
  end;
  ov := 'INPUT';
  iDisp := iDoc.all.tags(ov);
  if Assigned(IDisp) then
  begin
    IDisp.QueryInterface(IHTMLElementCollection, iColl);
    if Assigned(iColl) then
    begin
      for i := 1 to iColl.Get_length do
      begin
        iDisp := iColl.item(pred(i), 0);
        iDisp.QueryInterface(HTMLInputImage, InputImage);
        if Assigned(InputImage) then
        begin
          if InputImage.Name = 'submit' then
          // if the name is submit / falls der name submit lautet
          begin
            InputImage.Click;  // click it / klick es
          end;
        end;
      end;
    end;
  end;
end;



1000 Danke @ onlinehome und die anderen, aber vor allem dir!! Hast mir echt geholfen und Geduld mit meiner Dummheit gehabt *g*

Es geht!!

So, mein nächstes prob ist jetzt, ich würde gerne dass alles in einem Schritt geschieht (Website laden, Username/Pw eingeben und auf ok klicken), das würde ja auch gehen, aber wenn ich das alles in eine einzige procedure reinmach dann versucht er natürlich auf ok zu klicken noch bevor die seite geladen ist bzw. die Daten zu früh einzugeben.
Giebts da irgend nen Befehl damit die Anwendung einfach nach dem Befehl Website laden kurz ne Sekunde wartet und dann die Daten eingiebt, wieder ne Sekunde wartet und dann auf ok klickt?

Habs schon mit sleep(1000); und so probiert, aber ist ja klar dass das nicht geht da dann ja die ganze Anwendung ne Sekunde lang pausiert...

Nochmals danke, ich hab mein Ziel schon fast erreicht ;-)



Edit: Noch n kleines Prob:

ich will den Browser zu "javascript:scroll_popup('/messages/mail_sms_send.html',480,725);"

Navigaten aber das Problem ist jetzt, dass in der adresse " ' ' " enthalten sind die Delphi irgendwie durcheinander bringen, wie kann ich das lösen?

Danke!!

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 26.12.05 17:23 
ausblenden Quelltext
1:
javascript:scroll_popup('/messages/mail_sms_send.html',480,725);					

Evtl. die ' durch " ersetzen. Aber ob der Webbrowser Javascript über navigate aufrufen bzw. verarbeiten kann steht auch in den sternen. Einfach mal probieren.

Und den anderen Code mit try..finally Blöcken ausstatten. z. B.

ausblenden Ungetestetes Beispiel
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
begin
try
 webbrowser1.navigate('fdgfdg');
finally
 try
  //formular ausfüllen: username & password
 finally
  //submit-image drücken
 end;
end;
end;
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: Mo 26.12.05 17:45 
Omg, der Webbrowser scheint das Javascript nicht über Navigate aufrufen zu können, was mach ich jetzt?

Edit: Das mit den Try-Finally Blöcken hab ich mal anders gelöst, keine Ahnung ob das ne gute Variante war:

Hab 5 timer reingemacht, der erste zum Seite laden braucht 6 Sekunden, danach deaktivert er sich und aktiviert den nächsten Timer, und so weiter halt *g*

Alles was noch fehlt ist wie ich das dumme Sms-Fenster öffne das ja Javascipt ist...
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 26.12.05 18:13 
Mit den Timern ist zwar etwas umständlich tut aber auch seinen Zweck...

Wegen den SMS-Fensters:
Mach ein neues Formular und klopp nen webbrowser drauf. wieder das ganze anmelde zeugs (also der code von vorhin) und dann webbrowser1.navigate(rootdir+'/messages/mail_sms_send.html');
rootdir ist eine string-variable mit den server root pfad, z. B.
ausblenden Quelltext
1:
http://www.freenet.de					

Welchen Pfad du als rootdir definieren musst erfährst du wenn du auf die von dir genannte url gehst, dich dort anmeldest und den pfad welcher dann in der adressleiste steht kopierst, natürlich ohne den dateinamen und das abschließende /. Z. B. http://login.freenet.de/bla/irgendwas.php muss im string so stehen: http://login.freenet.de/bla

Verständlich?
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: Mo 26.12.05 18:21 
Also, die Adresse wo der Button zum Sms versenden steht, ist
ausblenden Quelltext
1:
http://office.freenet.de/mms/index.html					


Also muss ich dann jetzt

ausblenden Quelltext
1:
webbrowser1.navigate('http://office.freenet.de/mms/index.html'+'/messages/mail_sms_send.html');					


oder was?

Wenn ich auf Sms schreiben klicke seh ich nämlich keine Url, ist ja auch nur n Php Script....
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mo 26.12.05 18:24 
Du musst den Pfad nehmen, und keine Datei, also
ausblenden Delphi-Quelltext
1:
webbrowser1.navigate('http://office.freenet.de/mms/index.html'+'/messages/mail_sms_send.html');					

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: Mo 26.12.05 18:33 
Hm, wenn ich als Pfad

ausblenden Quelltext
1:
http://office.freenet.de/mms/index.html/messages/mail_sms_send.html					

eingebe, kommt trotzdem nur das standard fenster wo ich auf den Button klicken muss,
irgendwie brauch ich anscheinend das dumme java script....
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 26.12.05 18:36 
user profile iconDie Brotmafia hat folgendes geschrieben:
Hm, wenn ich als Pfad

ausblenden Quelltext
1:
http://office.freenet.de/mms/index.html/messages/mail_sms_send.html					

eingebe, kommt trotzdem nur das standard fenster wo ich auf den Button klicken muss,
irgendwie brauch ich anscheinend das dumme java script....


Au, das tut weh.....

So ist es richtig:
ausblenden Quelltext
1:
http://office.freenet.de/mms/messages/mail_sms_send.html					
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: Mo 26.12.05 19:03 
...

ausblenden Quelltext
1:
http://office.freenet.de/mms/messages/mail_sms_send.html					



Not Found
The requested URL /mms/messages/mail_sms_send.html was not found on this server.


Soviel dazu ^^
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 26.12.05 19:41 
user profile iconDie Brotmafia hat folgendes geschrieben:
...

ausblenden Quelltext
1:
http://office.freenet.de/mms/messages/mail_sms_send.html					



Not Found
The requested URL /mms/messages/mail_sms_send.html was not found on this server.


Soviel dazu ^^


Dann hast du uns die falsche url genannt. leider habe ich keinen freenet-account, sonst hätte ich mal nachgeschaut!
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: Mo 26.12.05 20:09 
Doch, das ist sicher die richtige Url!!

home.arcor.de/brotma...lphi/Clipboard01.jpg

home.arcor.de/brotma...lphi/Clipboard03.jpg


Hoffe ihr könnt mir noch helfen, ansonsten wäre die Arbeit der letzten 5 Stunden umsonst gewesen

:cry:
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 26.12.05 20:19 
Du könntest mal den Seiten-Quelltext der Freenetseite hier als Anhang hochladen. Dann kann ich mal schauen was das JavaScript alles macht. OK?
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: Mo 26.12.05 20:33 
Bitte sehr, und nochmals danke für deine Mühe!!
Einloggen, um Attachments anzusehen!
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 26.12.05 21:37 
Also,
ausblenden freenet.de JavaScript
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
function scroll_popup(url,xw,yw) 
{
  var wintop  = (screen.height - yw) / 2;
  var winleft = (screen.width - xw) / 2;
  jetzt = new Date();
  //var wintitle = jetzt.getTime();
  var wintitle = "scroll_popup";
  var params = "resizable,scrollbars,height=" + yw + ",width=" + xw + ",left=" + winleft + ",top=" + wintop;
  pop1 = window.open(url,wintitle,params);
}


Das ist der JavaScript-Code für das SMS-Popup. So wie ich sehe übergibt das Script das aktuelle Datum/Zeit als Fenstertitel. Eine Zeile darunter wird der Fenstertitel auf "scroll_popup" festgelegt. Hmm... Ich bin nicht so der JavaScript Profi! Was wird da mit der Variable pop1 gemacht?

Mir fällt nicht ein wieso dir da ein ungültiger Pfad gezeigt wird...

Aber du könntest mal einen Code suchen bzw. den für den Submit-Image zu modifizieren und dann auf der page einen klick auf den sms button zu machen...