Results 1 to 7 of 7

Thread: How do you Automaticly set the target

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default How do you Automaticly set the target

    How do you automatically set the target to a window based off of it's name I remember @Kasi did something like this when he helped me but I can't remember the name of the procedure

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Ok I've never done this before but as as far as I can tell this should work.
    Simba Code:
    var
      i: Integer;
      Procs: TSysProcArr;
      TargetWindow: String;

    begin
      TargetWindow := 'Chrome';
      Procs := GetProcesses;

      for i:=0 to High(Procs) do
        if Procs[i].Title = TargetWindow then
        begin
          SetTarget(Procs[i]);
          break;
        end;
    end.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    What Flight said.
    Also look at the function list on simba. specifically the last couple under "Other" and the ones under "Window"

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Ok I've never done this before but as as far as I can tell this should work.
    Simba Code:
    var
      i: Integer;
      Procs: TSysProcArr;
      TargetWindow: String;

    begin
      TargetWindow := 'Chrome';
      Procs := GetProcesses;

      for i:=0 to High(Procs) do
        if Procs[i].Title = TargetWindow then
        begin
          SetTarget(Procs[i]);
          break;
        end;
    end.
    Didn't work :/ I think it's because "Soulsplit" shows up as java platform blah blah blah on task manager

    @Kasi Looked there but Couldn't find anything (SetTarget('Soulsplit') = type mismatch..? )

  5. #5
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Start by getting a list of all your running processes:
    Simba Code:
    var
      i: Integer;
      Procs: TSysProcArr;

    begin
      Procs := GetProcesses;

      for i:=0 to High(Procs) do
        Writeln('['+ToStr(i)+'] '+Procs[i].Title);

    end.

    ...then determine which one is whatever you're trying to grab. And yes, if it's a private server it'll show up as just Java.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  6. #6
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Start by getting a list of all your running processes:
    Simba Code:
    var
      i: Integer;
      Procs: TSysProcArr;

    begin
      Procs := GetProcesses;

      for i:=0 to High(Procs) do
        Writeln('['+ToStr(i)+'] '+Procs[i].Title);

    end.

    ...then determine which one is whatever you're trying to grab. And yes, if it's a private server it'll show up as just Java.
    woot woot it showed up as "soulsplit 2"

    going to have to wait another 5 hours for your rep

  7. #7
    Join Date
    Aug 2013
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default

    From Simba doc:

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •