This script will open League of Legends Client for you and sign you in.

I plan on doing more with this but I think I will code it with Python.

Will have to change the Username and Password to be your own.


Would love feedback and tips for improvement. Thank you in advance.

Simba Code:
program Nexus;
{$I SRL-6/SRL.SIMBA}

//This program will open an .EXE for you.
//Change RunCommand line to the file path of the .EXE



const
  BufSize = 1024;


// Procedure RunCommand
// Snippet from CommanRunner by CynicRus
// Taken 21/2/18
// Link to orginal thread https://villavu.com/forum/showthread.php?t=112767&highlight=TProcess
// Small changes made by ElementPuss, these are commented out

function RunCommand(Cmd: string): Boolean;
var
    AProcess : TProcess;
    Buf : Array[1..BUFSIZE] of char;
    I,Count : longint;
    ss:string;

begin
  //Lines.Clear;
  AProcess.Init(Nil);
  try
  AProcess.SetCommandline(Cmd);
  AProcess.setOptions([poUsePipes,poNoConsole]);
  AProcess.execute;
  Repeat
    count:=AProcess.GetOutput().Read(buf,BufSize);
      For I:=1 to count do
      ss:=ss + buf[i];
  until Count=0;
  //Lines.Add(ss);
  Result := True;
  finally
  AProcess.Free;
  end;
end;

procedure ClientSize;
var
  x, y : Integer;
begin
  GetClientDimensions(x, y);
  Writeln(IntToStr(x) + '-x '  + IntToStr(y) + '-y');
end;

procedure PlaceMouse;
var
  Username, Password : String;
begin
  Username := '';    //Change to your username
  Password := '';   //Change to your password

  MouseBox(IntToBox(1080, 183, 1259, 201), Mouse_Left); //username box
  //Wait(Random(2000));
  SendKeys(Username, 0, 0);  //can change type speed if wanted
  Wait(Random(2000));
  MouseBox(IntToBox(1078, 240, 1259, 262), Mouse_Left); //password box
 // Wait(Random(2000));
  SendKeys(Password, 0, 0); //can change type speed if wanted
  Wait(2000);
  MouseBox(IntToBox(1078, 544, 1261, 567), Mouse_Left); //sign In
end;

// Function right from the Simba Documentation Example
// http://docs.villavu.com/simba/scriptref/window.html

function FindAndSetTarget(TitlePrefix: String; SetAsTarget: Boolean): Boolean;
var
  T: TSysProcArr;
  I: Integer;
begin
  T:= GetProcesses();
  for I := 0 to high(T) do
    if ExecRegExpr('^' + TitlePrefix, T[i].Title) then
    begin
      Result := True;
      if SetAsTarget then
      begin
        SetTarget(T[i]);
        ActivateClient;
      end;
    end;
end;

function ClientOpen: Boolean;
begin
  if (RunCommand('C:\Riot Games\League of Legends\LeagueClient.exe')) then
  begin
    WriteLn('It opened the .exe');
    WriteLn('Checking to see if client has spanwed yet');
    Wait(6000);
    begin
      if FindAndSettarget('League of Legends', True) then
        WriteLn('Yay found the client');
        Result := True;
        Exit;
    end
      WriteLn('Did not find the client');
      Exit;
  end else
    WriteLn('Did not open the client');
end;

procedure LogIn;
begin
  if (ClientOpen) then
  begin
    WriteLn('It open');
    PlaceMouse;
  end else
    WriteLn('Did not open');
end;



begin
LogIn;
end.