PDA

View Full Version : System.EnumerateProcesses not Working the way id like it to!what am i doing wrong


Wonderboy
04-17-2006, 02:42 PM
Whats wrong with this code,
i have tried different ways still it wont work.

what i am trying to do is put a code to on Show and when the application is running then i want it to check if notepad is running, and if it is i want it to display a message in a input object, that notepad is running, but if notepad is not running i want it to input that notepad is not running.
but i can not make it work, it seems simple but i can not figure it out!

this code is put on Show
file_to_check_for = "notepad.exe"; --have all lowercase
processes = System.EnumerateProcesses();

for j, file_path in processes do
file = String.SplitPath(file_path);
if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
Input.SetText("Input1", "Notepad is running");
else Input.SetText("Input1", "Notepad is not running");
end
end

Worm
04-17-2006, 02:53 PM
file_to_check_for = "notepad.exe"; --have all lowercase
processes = System.EnumerateProcesses();

bNotePadRunning = false;
for j, file_path in processes do
file = String.SplitPath(file_path);
if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
bNotePadRunning = true;
break;
end
end

if bNotePadRunning then
Input.SetText("Input1", "Notepad is running");
else
nput.SetText("Input1", "Notepad is not running");
end

Wonderboy
04-17-2006, 02:57 PM
Worm you did it! :yes
you sure are good at this
As always!
A hugh thanks to you!
i got an error on line 16 at first , but i realised you just missed the I in input.
thanks again!