mausi125 Advanced Cheater Reputation: 1
Joined: 05 Jun 2014 Posts: 86
|
Posted: Sun Oct 19, 2014 2:50 pm Post subject: Help for trainer and process |
|
|
Hello i have problem with my trainer, my game have two same process and trainer open wrong process. I saw this tutorial I do not understand
Code:
local target = "abc.exe";
local f = io.popen( string.format( "TASKLIST /FI \"IMAGENAME eq %s\" /FO csv", target ) );
assert( f, "Failed to obtain results from TASKLIST.exe!" );
-- Do work here..
f:close();
You can then parse each line returned like this:
Code:
for x in f:lines() do
-- Strip the header line so we don't try to read it as a process..
local input = string.gsub( x, "(.*),\"Mem Usage\"", '' );
if string.len( input ) > 0 then
local parts = input:split( "[^,]+" );
print( #parts );
print( parts[1] ); -- prints the process name
print( parts[2] ); -- prints the process id
end
end
Using the string:split function from:
Code:
string.split = function(str, pattern)
pattern = pattern or "[^%s]+"
if pattern:len() == 0 then pattern = "[^%s]+" end
local parts = {__index = table.insert}
setmetatable(parts, parts)
str:gsub(pattern, parts)
setmetatable(parts, nil)
parts.__index = nil
return parts
end
|
|