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:
| function TForm1.FillFormName(Versuche: integer; WebBrowser: TWebBrowser; FieldName: string; Value: string; Fundstelle:integer): Boolean; var i, j, Fundstelle2: Integer; FormItem: Variant; begin try delay(10); result := false; application.ProcessMessages; Fundstelle2 := 0; if WebBrowser.OleObject.Document.all.tags('FORM').Length > 0 then for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do begin application.ProcessMessages; FormItem := WebBrowser.OleObject.Document.forms.Item(I); for j := 0 to FormItem.Length - 1 do begin application.ProcessMessages; try if FormItem.Item(j).Name = FieldName then begin inc(Fundstelle2); if Fundstelle2 = Fundstelle then begin FormItem.Item(j).Value := Value; application.ProcessMessages; if FormItem.Item(j).Value = Value then begin Result := True; Exit; end end; end; except on E: Exception do Write_Msg(true, 'LOG', Exe_pfad, nil, ('FillFormName 1 / ' + GetLastErrorText(E))); end; end; end; if result = false then if Versuche > 0 then begin delay(100); Write_Msg(true, 'LOG', Exe_pfad, nil, ('FillFormName Versuch NR: ' + IntToStr(Versuche))); FillFormName(Versuche-1 ,Webbrowser,Fieldname,Value,Fundstelle); end; except on E: Exception do Write_Msg(true, 'LOG', Exe_pfad, nil, ('FillFormName 2 / ' + GetLastErrorText(E))); end; end;
procedure test; begin Form1.FillFormName(1 ,Form1.Webbrowser_0, 'nick', 'test', 1); end;
procedure TForm1.Panel41Click(Sender: TObject); var ThreadID : Cardinal; begin createthread(0,0,@test,nil,0,ThreadID); end; |