Thank you so much Robert! That´s exactly what i needed! I will research more on win32ole... Thanks again! Rodrigo Julian Martin
________________________________ De: [EMAIL PROTECTED] en nombre de Robert Gilmore Enviado el: Lun 10/04/2006 01:31 a.m. Para: [email protected] Asunto: Re: [Wtr-general] Killing several processes open? I'm far from an expert - but I've been using WMI a lot lately in the C# world so figured I'd try using it via WIN32OLE - it seems to work. It's much simpler than using Win32API. require 'win32ole' mgmt = WIN32OLE.connect('winmgmts:\\\\.') mgmt.InstancesOf("win32_process").each{ |proc| puts proc.name } mgmt.ExecQuery("Select * from Win32_Process Where Name = ' Notepad.exe'").each{ |item| item.Terminate() } On 4/9/06, Rodrigo Julian Martin <[EMAIL PROTECTED] > wrote: Hi! I'm trying to make a code for killing all running processes that i need to close. I've this function for javascript: [code] function KillProcess(PName) { var Count = 0; var p = Sys.WaitProcess(PName, 1000, 1); while (p.Exists) { Count++; p.Terminate(); while (p.Exists) Delay(50); p = Sys.WaitProcess(PName, 1000, 1); } return Count; } ... KillProcess("Excel"); ... [/code] Is there a way to do this in ruby+watir? I was reading about the Sys::Process, but I don't find the way. I'm running on a Windows 2000. I really don't want to end up making a bat file =(.. any help would be really appreciated Cheers from Argentina, and Thanks in advance! Rodrigo Julian Martin _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
<<winmail.dat>>
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
