FoxLeader
10-12-2007, 01:56 PM
Hello,
I looked at some exemples and said "Cool! That's simple". But I tried and got... nothing. It's probably due to the table colums, which I don't know. So the code:
-- Get the titles and window handles of all open windows.
windows = Window.EnumerateProcesses();
-- A variable containing text in the title you want to search for.
window_name = "Apache.exe";
-- Loop through the table of windows.
for handle, title in windows do
-- Check if the window title has the target text.
result = String.Find(title, window_name, 1, false);
-- if the string was found in the title, send the window a close message.
if (result ~= -1) then
Window.Close(handle, CLOSEWND_SENDMESSAGE);
end
end
I think you undertsood I wanted to kill the process named "Apache.exe". So does anybody sees the error?
Thanks!
I looked at some exemples and said "Cool! That's simple". But I tried and got... nothing. It's probably due to the table colums, which I don't know. So the code:
-- Get the titles and window handles of all open windows.
windows = Window.EnumerateProcesses();
-- A variable containing text in the title you want to search for.
window_name = "Apache.exe";
-- Loop through the table of windows.
for handle, title in windows do
-- Check if the window title has the target text.
result = String.Find(title, window_name, 1, false);
-- if the string was found in the title, send the window a close message.
if (result ~= -1) then
Window.Close(handle, CLOSEWND_SENDMESSAGE);
end
end
I think you undertsood I wanted to kill the process named "Apache.exe". So does anybody sees the error?
Thanks!