Beiträge von derwixxxer

    you want that script? see it!


    ihr denkt 10 mycups sind viel? ich hab 89!


    hier habt ihr euer script:
    -------


    unit Unit1;


    // compiled with delphi 5
    // dmd.ini in C:\ contains questions+answers - thx to wasimmer.de
    // ebay.html in C:\ contains template of answering page


    interface


    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    StdCtrls, Psock, NMHttp, IniFiles, Shellapi, ComCtrls, Math;


    type
    Tform_main = class(TForm)
    http: TNMHTTP;
    Label1: TLabel;
    memo_source: TMemo;
    Label2: TLabel;
    ed_question: TEdit;
    Button3: TButton;
    lab_type: TLabel;
    lab_qid: TLabel;
    Button6: TButton;
    lab_same: TLabel;
    lab_found: TLabel;
    progress: TProgressBar;
    Button1: TButton;
    stop: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure httpPacketRecvd(Sender: TObject);
    function requestit: Boolean;
    private
    { Private-Deklarationen }
    public
    { Public-Deklarationen }
    end;


    var
    form_main: Tform_main;


    implementation


    {$R *.DFM}


    procedure Tform_main.Button1Click(Sender: TObject);
    var
    done: Boolean;
    begin


    repeat
    Application.ProcessMessages; //msgs
    if stop.Checked then exit;
    done := requestit;
    until done;



    end;


    procedure Tform_main.Button3Click(Sender: TObject);
    begin


    memo_source.Lines.Clear;
    button6.Enabled := True;


    end;


    procedure Tform_main.Button4Click(Sender: TObject);
    var
    ini: TIniFile;
    begin


    ini := TIniFile.Create('C:\dmd.ini');
    ShowMessage(ini.ReadString(ed_question.Text, 'theanswer', 'NOTFOUND'));


    end;


    procedure Tform_main.Button5Click(Sender: TObject);
    var
    htmfile: TStringlist;
    begin


    htmfile := TStringlist.Create;
    htmfile.LoadFromFile('C:\ebay.html');
    htmfile.Text := StringReplace(htmfile.Text, '#dmdanswerid#', lab_qid.Caption, [rfIgnoreCase, rfReplaceall]);
    htmfile.Text := StringReplace(htmfile.Text, '#theanswer#', 'keine ahnung', [rfIgnoreCase, rfReplaceall]);
    htmfile.SaveToFile('C:\ebaysend.html');
    htmfile.Free;



    end;


    procedure Tform_main.Button6Click(Sender: TObject);
    var
    ini: TIniFile;
    a_begin, a_end: Integer;
    a_answer: String;
    htmfile: TStringlist;
    begin


    progress.Position := 0;
    lab_type.Visible := False;
    lab_same.Visible := False;
    lab_found.Visible := False;


    http.Get('http://deutschlandmachtdurch.ebay.de/main.html');
    memo_source.Text := http.Body;
    if Pos('erscheint gleich', memo_source.Text) > 0
    then begin
    lab_type.Caption := 'already answered';
    lab_type.Visible := True;
    memo_source.Lines.Clear;
    exit;
    end
    else begin
    lab_type.Caption := 'VALID';


    a_begin := Pos('<span class="boldw">', memo_source.Text);
    a_end := Pos('?</span><br>', memo_source.Text);
    if ed_question.Text = Copy(memo_source.Text, a_begin+20, a_end-a_begin-19)
    then begin
    lab_same.Caption := 'same';
    lab_same.Visible := True;
    exit;
    end;


    lab_same.Visible := False;
    ed_question.Text := Copy(memo_source.Text, a_begin+20, a_end-a_begin-19);
    a_begin := Pos('name="dmd_answer', memo_source.Text);
    a_end := Pos('size="54">', memo_source.Text);
    lab_qid.Caption := Copy(memo_source.Text, a_begin+6, a_end-a_begin-17);


    ini := TIniFile.Create('C:\dmd.ini');
    a_answer := ini.ReadString(ed_question.Text, 'theanswer', 'NOTFOUND');
    ini.free;


    if not (a_answer = 'NOTFOUND')
    then begin
    lab_found.Caption := 'NOTFOUND';
    lab_found.Visible := True;
    htmfile := TStringlist.Create;
    htmfile.LoadFromFile('C:\ebay.html');
    htmfile.Text := StringReplace(htmfile.Text, '#dmdanswerid#', lab_qid.Caption, [rfIgnoreCase, rfReplaceall]);
    htmfile.Text := StringReplace(htmfile.Text, '#theanswer#', a_answer, [rfIgnoreCase, rfReplaceall]);
    htmfile.SaveToFile('C:\ebaysend.html');
    htmfile.Free;
    button6.Enabled := False;
    ShellExecute(Application.Handle, 'open', PCHar('C:\ebaysend.html'), nil, nil, SW_ShowNormal);
    lab_found.Visible := True; lab_found.Caption := 'FOUND';
    end else begin lab_found.Visible := True; lab_found.Caption := 'NOTFOUND'; end;
    end;


    end;


    procedure Tform_main.httpPacketRecvd(Sender: TObject);
    var
    perc: Extended;
    percint: Integer;
    begin


    perc := (http.BytesRecvd*100)/http.BytesTotal;
    percint := Ceil(perc);
    if percint > 100 then percint := 100;
    if percint < 0 then percint := 0;
    progress.Position := percint;


    end;


    function Tform_main.requestit: Boolean;
    var
    ini: TIniFile;
    a_begin, a_end: Integer;
    a_answer: String;
    htmfile: TStringlist;
    begin



    result := False;
    progress.Position := 0;


    http.Get('http://deutschlandmachtdurch.ebay.de/main.html');
    memo_source.Text := http.Body;
    if Pos('erscheint gleich', memo_source.Text) > 0
    then begin
    lab_type.Caption := 'already answered';
    lab_type.Visible := True;
    lab_same.Visible := False;
    lab_found.Visible := False;
    memo_source.Lines.Clear;
    exit;
    end
    else begin
    lab_type.Caption := 'VALID';
    lab_type.Visible := True;
    lab_same.Visible := False;
    lab_found.Visible := False;


    a_begin := Pos('<span class="boldw">', memo_source.Text);
    a_end := Pos('?</span><br>', memo_source.Text);
    if ed_question.Text = Copy(memo_source.Text, a_begin+20, a_end-a_begin-19)
    then begin
    lab_same.Caption := 'same';
    lab_type.Visible := True;
    lab_same.Visible := True;
    lab_found.Visible := False;
    exit;
    end;


    lab_same.Visible := False;
    ed_question.Text := Copy(memo_source.Text, a_begin+20, a_end-a_begin-19);
    a_begin := Pos('name="dmd_answer', memo_source.Text);
    a_end := Pos('size="54">', memo_source.Text);
    lab_qid.Caption := Copy(memo_source.Text, a_begin+6, a_end-a_begin-17);


    ini := TIniFile.Create('C:\dmd.ini');
    a_answer := ini.ReadString(ed_question.Text, 'theanswer', 'NOTFOUND');
    ini.free;


    if not (a_answer = 'NOTFOUND')
    then begin
    lab_found.Caption := 'NOTFOUND';
    lab_type.Visible := True;
    lab_same.Visible := True;
    lab_found.Visible := True;
    htmfile := TStringlist.Create;
    htmfile.LoadFromFile('C:\ebay.html');
    htmfile.Text := StringReplace(htmfile.Text, '#dmdanswerid#', lab_qid.Caption, [rfIgnoreCase, rfReplaceall]);
    htmfile.Text := StringReplace(htmfile.Text, '#theanswer#', a_answer, [rfIgnoreCase, rfReplaceall]);
    htmfile.SaveToFile('C:\ebaysend.html');
    htmfile.Free;
    button6.Enabled := False;
    ShellExecute(Application.Handle, 'open', PCHar('C:\ebaysend.html'), nil, nil, SW_ShowNormal);
    lab_found.Visible := True; lab_found.Caption := 'FOUND';
    result := True;
    end
    else begin
    lab_found.Visible := True; lab_found.Caption := 'NOTFOUND';
    lab_type.Visible := True;
    lab_same.Visible := True;
    lab_found.Visible := True;
    end;
    end;


    end;


    end.
    ----
    stay coding baby