From: x1 Date: 2005-12-09T15:13:34+09:00 Subject: Re: Win32OLE: Output parameters, Dispatch IDs I find it strange that the win32ole package cant handle out params. Hunting in ObjectSpace with a semi-production script doesn't give me the "warm and fuzzies". Creating a basic .vbs file and calling it as such: pid = `cscript.exe exec.vbs`.split("\n")[3] ...works, but it's still a hack IMO. Thanks again for the kind suggestions but since I'm still learning ruby, knowing the precise problem or solution with this scenario would be optimal. On 12/9/05, dave.burt@gmail.com wrote: > x1 complained: > > --not sure how accurate this would be once 2 or more instances of > > "notepad" are running simultaneously. > > pids = [] > ObjectSpace.each_object(Array) do |arr| > pid << arr[3] if arr.size == 4 && arr[0, 3] == ["notepad", nil, nil] > end > > You can easily collect them all. If you get one list before the Create > call and one after, the difference is likely to be the PID you're > after. > > Of course, in practical Ruby, it's going to be easier to use > Process.create #=> pid from the Win32-Utils library, or even to use > Win32API or DL to call CreateProcess() directly. > > Cheers, > Dave > > >