SRL Archive - OSR Help

How do you Automaticly set the target


rj

2013-07-25 21:30:30

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

Flight

2013-07-25 21:39:27

Ok I've never done this before but as as far as I can tell this should work.

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.

Kasi

2013-07-25 21:46:04

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

rj

2013-07-25 21:47:35

From: Flight
Ok I've never done this before but as as far as I can tell this should work.

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..? )

Flight

2013-07-25 22:01:41

Start by getting a list of all your running processes:

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.

rj

2013-07-25 22:10:46

From: Flight
Start by getting a list of all your running processes:

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

bgtemp

2013-08-06 16:05:58

From Simba doc:

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;