Présentation

Fermer Boulets

Fermer Cheat

Fermer Coalitions

Fermer ETPro

Fermer Enemy Territory et physique

Fermer Enemy territory et Delphi

Fermer Les constructions

Fermer Logiciels

Fermer Ma Config

Fermer Trucs et astuces

Fermer Tutos

Fermer Videos

Fermer Villes

Technique
Sondage
 
Résultats
Free Box
Free Box
Visites

 205445 visiteurs

 1 visiteur en ligne

Logiciels - LNA Yawn

 

 

 

LNA Yawn

 

Pour écrire dans la console, il faut trouver la fenêtre ETQW Winconsole

Et écrire dedans.

procedure Ecris(s:string);  //procedure permettant d'écr

ire dans la console de ET
var
  wnd: HWND;
  i: Integer;
begin

// Pour trouver la fenêtre de la console
 wnd := FindWindow('ETQW WinConsole',nil);

 // s'il la trouve
 if wnd <> 0 then
 begin
   // il cherche dans la fenetre de la console la partie où on va écrire
   wnd := FindWindowEx(wnd, 0, 'Edit', nil);

   // on écrit dedans
   for i := 1 to Length(s) do
     SendMessage(wnd, WM_CHAR, Word(s[i]), 0);

   // puis on appuie sur Entrer pour envoyer la commande
   PostMessage(wnd, WM_KEYDOWN, VK_RETURN, 1835009);
   sleep(500);
 end;

end;

 

Il faut aussi récupérer le contenu de la console :

 

function CopyEdit(HD:Hwnd):string;   //Fonction permettant de récupérer le contenu de la console
var Size : integer;
begin
    Result:='';
    SendMessage(HD,WM_SETFOCUS, 0, 0);

    Size:=SendMessage(HD,WM_GETTEXTLENGTH,0,0)+1;
    SetLength(Result,Size);

    SendMessage(HD,WM_GETTEXT,Size,Integer(@Result[1]));
    SendMessage(HD,WM_KillFOCUS, 0, 0);
end;

 

 

 

Code complet :

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, mmSystem, StdCtrls, ComCtrls, ShellApi, clipbrd, jpeg,
  Grids;

type
  TForm1 = class(TForm)
    Label4: TLabel;
    Label5: TLabel;
    Timer1: TTimer;
    Memo1: TMemo;
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label6: TLabel;
    ProgressBar1: TProgressBar;
    Label7: TLabel;
    Image1: TImage;
    Edit2: TEdit;
    StringGrid1: TStringGrid;
    Memo2: TMemo;
    Memo3: TMemo;
    Timer2: TTimer;
    procedure Timer2Timer(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure Label5Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Label4Click(Sender: TObject);


  private
    { Déclarations privées }
    procedure Hotkey( Var msg: TWMHotkey ); message WM_HOTKEY;
  public
    { Déclarations publiques }
  end;

var
  Form1: TForm1;
  i : integer;
  bascule : boolean;
  nbkill : integer;

const HK_ID: integer = 1000;

implementation

{$R *.dfm}



procedure Ecris(s:string);  //procedure permettant d'écrire dans la console de ET
var
  wnd: HWND;
  i: Integer;
begin

// Pour trouver la fenêtre de la console
 wnd := FindWindow('ETQW WinConsole',nil);

 // s'il la trouve
 if wnd <> 0 then
 begin
   // il cherche dans la fenetre de la console la partie où on va écrire
   wnd := FindWindowEx(wnd, 0, 'Edit', nil);

   // on écrit dedans
   for i := 1 to Length(s) do
     SendMessage(wnd, WM_CHAR, Word(s[i]), 0);

   // puis on appuie sur Entrer pour envoyer la commande
   PostMessage(wnd, WM_KEYDOWN, VK_RETURN, 1835009);
   // On appuie sur la touche Espace (servait dans ET mais ne semble pas servir dans ETQW)
   //PostMessage(wnd, WM_KEYDOWN, VK_SPACE, 0);
   sleep(500);
 end;

end;


procedure TForm1.Label5Click(Sender: TObject);
begin
  ShellExecute(0,                // Handle d'une fenêtre
    'open',                      // Opération à effectuer
    'http://www.clan-lna.fr/',    // Application à lancer ou document à ouvrir
    '',                          // Arguments de la ligne de commande
    '',                          // Répertoire par défaut
    SW_SHOWNORMAL);
end;

function CopyEdit(HD:Hwnd):string;   //Fonction permettant de récupérer le contenu de la console
var Size : integer;
begin
    Result:='';
    SendMessage(HD,WM_SETFOCUS, 0, 0);

    Size:=SendMessage(HD,WM_GETTEXTLENGTH,0,0)+1;
    SetLength(Result,Size);

    SendMessage(HD,WM_GETTEXT,Size,Integer(@Result[1]));
    SendMessage(HD,WM_KillFOCUS, 0, 0);
end;

procedure ajoute(s1,s2:string);
var
  i : integer;
  existedeja : boolean;
begin
  with form1 do
  begin
    existedeja := false;
    for I := 0 to Stringgrid1.RowCount - 1 do
    begin
      if (Stringgrid1.Cells[0,i]=s1) and (Stringgrid1.Cells[1,i]=s2) then existedeja := true;
      if (Stringgrid1.Cells[0,i]=s1) and (Stringgrid1.Cells[1,i]<>s2) then
      begin
        //if (Stringgrid1.Cells[0,i]<>'e1a65518') then
          Ecris('addchatline "^2Fake : ^1'+s2+'^2 is ^1'+Stringgrid1.Cells[1,i]+'"');
      end;
    end;

    if not existedeja then
    begin
        Stringgrid1.RowCount :=Stringgrid1.RowCount + 1;
        Stringgrid1.Cells[0,Stringgrid1.RowCount-1]:=s1;
        Stringgrid1.Cells[1,Stringgrid1.RowCount-1]:=s2;
        Ecris('addchatline "^3Add : ^2'+s2+'"');
    end
    else
      Ecris('addchatline "^6Already exist : ^5'+s2+'"');
    Label7.Caption := IntToStr(Stringgrid1.RowCount);
  end;

end;

procedure ajoute2(s1,s2:string);
var
  i : integer;
  existedeja : boolean;
begin
  with form1 do
  begin
    existedeja := false;
    for I := 0 to Stringgrid1.RowCount - 1 do
    begin
      if (Stringgrid1.Cells[0,i]=s1) and (Stringgrid1.Cells[1,i]=s2) then existedeja := true;
      if (Stringgrid1.Cells[0,i]=s1) and (Stringgrid1.Cells[1,i]<>s2) then
      begin
        //if (Stringgrid1.Cells[0,i]<>'e1a65518') then
          //Ecris('addchatline "^2Fake : ^1'+s2+'^2 is ^1'+Stringgrid1.Cells[1,i]+'"');
      end;
    end;

    if not existedeja then
    begin
        Stringgrid1.RowCount :=Stringgrid1.RowCount + 1;
        Stringgrid1.Cells[0,Stringgrid1.RowCount-1]:=s1;
        Stringgrid1.Cells[1,Stringgrid1.RowCount-1]:=s2;
        Ecris('addchatline "^3Add : ^2'+s2+'"');
    end;
    //else
    //  Ecris('addchatline "^6Already exist : ^5'+s2+'"');
    Label7.Caption := IntToStr(Stringgrid1.RowCount);
  end;

end;


procedure TForm1.Hotkey( Var msg: TWMHotkey );
var
  i:integer;
  wnd1, wnd2: HWND;
  s:string;
begin
  if Msg.HotKey = HK_ID then   //si ALT+K est tapé alors
  with form1 do
  begin
    Ecris('pb_plist');
    Ecris('addchatline "^2*** ^3L^oN^nA  ^7Yawn ! ^2***"');
    Memo1.Lines.Clear;

    wnd1 := FindWindow('ETQW WinConsole',nil);

    //trouve la fenetre de la console de ETQW
    if wnd1 <> 0 then
    begin
      wnd2 := FindWindowEx(wnd1, 0, 'Edit', nil);  //cherche la console dans la fenetre
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);

      Memo1.Lines.Add(CopyEdit(wnd2));

      i:= memo1.Lines.Count-1;

      while (pos(']pb_plist',Memo1.Lines[i])<>1) and (i>0) do
      begin
        s:=Memo1.Lines[i];
        if (pos('PunkBuster Client: ',s)=1) and (pos('(-)',s)=31) then
          Ajoute (copy(s,23,8),copy(s,pos('}',s)+2,255));
        dec(i);
      end;
    end;
  end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  i:integer;
  wnd1, wnd2: HWND;
  s:string;
begin
  with form1 do
  begin

    //Ecris('addchatline "^2*** ^3L^oN^nA  ^7Yawn ! ^2*** ^6test 1"');
    Memo1.Lines.Clear;

    wnd1 := FindWindow('ETQW WinConsole',nil);

    //trouve la fenetre de la console de ETQW
    if wnd1 <> 0 then
    begin
      wnd2 := FindWindowEx(wnd1, 0, 'Edit', nil);  //cherche la console dans la fenetre
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);

      Memo1.Lines.Add(CopyEdit(wnd2));

      i:= memo1.Lines.Count-1;

      while (pos('PunkBuster Client: Receiving from PB Server',Memo1.Lines[i])=0) and (pos(']pb_plist',Memo1.Lines[i])<>1) and (pos('entered the game.',Memo1.Lines[i])=0) and (pos(']pb_plist',Memo1.Lines[i])<>1) and (i>0) do
      begin
        dec(i);
      end;
      if pos('entered the game.',Memo1.Lines[i])<>0 then
      begin
        timer2.Enabled := true;
      end;
     
    end;
  end;
end;


procedure TForm1.Timer2Timer(Sender: TObject);
var
  i:integer;
  wnd1, wnd2: HWND;
  s:string;
begin
  with form1 do
  begin
    Ecris('pb_plist');
    Ecris('addchatline "^2*** ^3L^oN^nA  ^7Yawn ! ^2*** ^6Nouvel arrivant"');
    Memo1.Lines.Clear;

    wnd1 := FindWindow('ETQW WinConsole',nil);

    //trouve la fenetre de la console de ETQW
    if wnd1 <> 0 then
    begin
      wnd2 := FindWindowEx(wnd1, 0, 'Edit', nil);  //cherche la console dans la fenetre
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);
      wnd2 := GetNextWindow(wnd2,GW_HWNDNEXT);

      Memo1.Lines.Add(CopyEdit(wnd2));

      i:= memo1.Lines.Count-1;

      while (pos(']pb_plist',Memo1.Lines[i])<>1) and (i>0) do
      begin
        s:=Memo1.Lines[i];
        if (pos('PunkBuster Client: ',s)=1) and (pos('(-)',s)=31) then
          Ajoute2 (copy(s,23,8),copy(s,pos('}',s)+2,255));
        dec(i);
      end;
    end;
    timer2.Enabled := false;
  end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
  f : textfile;
  s:string;
  i:integer;
begin
  assignfile (f,'LNAYawn.lna');
  rewrite (f);
  for i := 0 to StringGrid1.RowCount - 1 do
  begin
    //if (Stringgrid1.Cells[0,i]<>'e1a65518') and (Stringgrid1.Cells[1,i]<>'kriterium') then
      writeln(f,Cryptnfois(Stringgrid1.Cells[0,i]+Stringgrid1.Cells[1,i]));
  end;
  //writeln(f,Cryptnfois('e1a65518kriterium'));
  closefile(f);
  UnRegisterHotkey(Handle, HK_ID);

end;

procedure TForm1.FormCreate(Sender: TObject);
var
  f : textfile;
  s,s1:string;
  i:integer;
begin
  if RegisterHotKey(Handle, HK_ID, MOD_ALT, ord('K')) = False then
    sndPlaySound('c:WindowsMediachord.wav', SND_ASYNC);
  assignfile (f,'LNAYawn.lna');
  reset (f);
  i:=0;
  while not(eof(f)) do
  begin
    readln(f,s);
    memo2.Lines.Add(s);
    s1:=Cryptnfois(copy(s,1,length(s)));
    memo3.Lines.Add(s1);
    Stringgrid1.Cells[0,i]:=copy(s1,1,8);
    Stringgrid1.Cells[1,i]:=copy(s1,9,255);
    inc(i);
    Stringgrid1.RowCount:=i;
  end;
  closefile(f);
  Label7.Caption := IntToStr(Stringgrid1.RowCount);
end;

procedure TForm1.Label4Click(Sender: TObject);
begin
begin
  ShellExecute(0,                // Handle d'une fenêtre
    'open',                      // Opération à effectuer
    'http://www.kriterium.fr/',    // Application à lancer ou document à ouvrir
    '',                          // Arguments de la ligne de commande
    '',                          // Répertoire par défaut
    SW_SHOWNORMAL);
end;
end;


end.

 


Date de création : 29/11/2009 @ 12:13
Dernière modification : 29/11/2009 @ 12:13
Catégorie :


Imprimer l'article Imprimer l'article

Réactions à cet article

Personne n'a encore laissé de commentaire.
Soyez donc le premier !

Spécial !
Préférences

Se reconnecter
---

Votre nom (ou pseudo) :

Votre code secret


 Nombre de membres 0 membre


Connectés :

( personne )
Webmaster - Infos
Lettre d'information
Pour avoir des nouvelles de ce site, inscrivez-vous à notre Newsletter.
S'abonner
Se désabonner
Abonné
( personne )

Snif !!!
Nouvelles des Amis
Recherche



^ Haut ^