Linke click yapılan yerdeki j değeri bulunan linkin sırasıdır. Sayfa bazında 3. Sayfa 2. Link gibi sonuç alırsınız.
Eğer toplam içerisinde kaçıncı link olduğu konusunda istatistik veri ihtiyacı varsa vir integer değişken atayın genelsiralama olsun, click edilene kadar bu değişkene 1 ekleyin, click anında bu değişkenin değeri istediğiniz sonucu verir
İnternet explorer ile açılan sayfa içinde dolaşma
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
Re: İnternet explorer ile açılan sayfa içinde dolaşma
Hocam genel sıralama almak istedim fakat sadece 1 değeri geldi

Kod: Tümünü seç
Function AradigimLinkeTikla( strAra, strURL, strBulunacak: String; iMaxSonarkiSayfa:Integer ): boolean;
procedure Bekle( IEpp: OleVariant );
begin
while (IEpp.Busy) do
begin
Sleep(1);
Application.ProcessMessages;
end;
end;
var
I, J, Siralama: Integer;
IEpp : OleVariant;
XLink, XSayfa : String;
boolGoogle : Boolean;
iLinkSay : Integer;
begin
if (VarIsEmpty(IEpp)) then
begin
IEpp := CreateOleObject('InternetExplorer.Application');
ShowWindow(IEpp.HWND, SW_SHOWMAXIMIZED);
IEpp.Visible := True;
end;
IEpp.Navigate('http://www.bing.com/search?q=' + strAra);
Bekle( IEpp );
boolGoogle := False;
Result := False;
i := 0;
Siralama := 0;/// -------------------------
iLinkSay := Integer(IEpp.Document.Links.length);
while (i < iLinkSay ) AND (NOT boolGoogle) AND (iMaxSonarkiSayfa >= 0) do
begin
XLink := IEpp.Document.Links.Item(I);
XSayfa := IEpp.Document.Links.Item(I).Text;
memo1.Lines.Add(Format('%d', [Siralama +1])); /// -------------------------
if Pos( 'Sonraki', XSayfa ) > 0 then
begin
showmessageFmt('%d',[ iMaxSonarkiSayfa ] );
Dec(iMaxSonarkiSayfa);
// Sona geldik, yeni sayfayla devam edicez...
IEpp.Document.Links(I).Click;
Bekle( IEpp );
i := 0;
iLinkSay := Integer(IEpp.Document.Links.length);
XLink := IEpp.Document.Links.Item(I);
end;
if Pos( UpperCase(strUrl), UpperCase(XLink) ) > 0 then
begin
boolGoogle := true;
IEpp.Document.Links(I).Click;
Bekle( IEpp );
J := 0;
while (J < Integer(IEpp.Document.Links.length) ) AND (NOT Result) do
begin
XSayfa := IEpp.Document.Links.Item(J).Text;
if Pos( strBulunacak, XSayfa ) > 0 then
begin
IEpp.Document.Links(J).Click;
Result := True;
end;
Bekle( IEpp );
inc(J);
end;
end;
inc(i);
end; // While
end;
Re: İnternet explorer ile açılan sayfa içinde dolaşma
Selam... senin için kodlamada ekleme yaptım sanırım işini görecektir ama tüm linkleri sayıyor örnek: aranan link bing de sıra 35 ise sonuç 137 gibi buluyor tüm linkleri sayıyor gercek link ayıklama nasıl yapılır bilimiyorum...
Siralama: Integer;
Siralama := 0
Siralama :=Siralama + 1;
Form3.Memo1.Lines.Add(floattostr(Say));
Siralama: Integer;
Siralama := 0
Siralama :=Siralama + 1;
Form3.Memo1.Lines.Add(floattostr(Say));
dogan yazdı:Hocam genel sıralama almak istedim fakat sadece 1 değeri geldi![]()
Kod: Tümünü seç
Function AradigimLinkeTikla( strAra, strURL, strBulunacak: String; iMaxSonarkiSayfa:Integer ): boolean; procedure Bekle( IEpp: OleVariant ); begin while (IEpp.Busy) do begin Sleep(1); Application.ProcessMessages; end; end; var I, J, Siralama: Integer; IEpp : OleVariant; XLink, XSayfa : String; boolGoogle : Boolean; iLinkSay : Integer; begin if (VarIsEmpty(IEpp)) then begin IEpp := CreateOleObject('InternetExplorer.Application'); ShowWindow(IEpp.HWND, SW_SHOWMAXIMIZED); IEpp.Visible := True; end; IEpp.Navigate('http://www.bing.com/search?q=' + strAra); Bekle( IEpp ); boolGoogle := False; Result := False; i := 0; Siralama := 0 iLinkSay := Integer(IEpp.Document.Links.length); while (i < iLinkSay ) AND (NOT boolGoogle) AND (iMaxSonarkiSayfa >= 0) do begin XLink := IEpp.Document.Links.Item(I); XSayfa := IEpp.Document.Links.Item(I).Text; Siralama :=Siralama + 1; if Pos( 'Sonraki', XSayfa ) > 0 then begin showmessageFmt('%d',[ iMaxSonarkiSayfa ] ); Dec(iMaxSonarkiSayfa); // Sona geldik, yeni sayfayla devam edicez... IEpp.Document.Links(I).Click; Bekle( IEpp ); i := 0; iLinkSay := Integer(IEpp.Document.Links.length); XLink := IEpp.Document.Links.Item(I); end; if Pos( UpperCase(strUrl), UpperCase(XLink) ) > 0 then begin boolGoogle := true; IEpp.Document.Links(I).Click; Bekle( IEpp ); J := 0; while (J < Integer(IEpp.Document.Links.length) ) AND (NOT Result) do begin XSayfa := IEpp.Document.Links.Item(J).Text; if Pos( strBulunacak, XSayfa ) > 0 then begin Form3.Memo1.Lines.Add(floattostr(Say));//------ekledim------------- IEpp.Document.Links(J).Click; Result := True; end; Bekle( IEpp ); inc(J); end; end; inc(i); end; // While end;