[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Python's win32com.client for Ruby?

woodyee

1/25/2007 4:42:00 PM

Hi! I was looking over the python scripts for Windows
(http://www.microsoft.com/technet/scriptcenter/scripts/python/pyindex.msp...).
I
noticed that most are using win32com.client. Is there a similiar
library for Ruby?

For example, here's a script for listing installed software. I'm trying
to figure out how to
translate this to Ruby. Thanks!


import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices =
objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product")
for objItem in colItems:
print "Caption: ", objItem.Caption
print "Description: ", objItem.Description
print "Identifying Number: ", objItem.IdentifyingNumber
print "Install Date: ", objItem.InstallDate
print "Install Date 2: ", objItem.InstallDate2
print "Install Location: ", objItem.InstallLocation
print "Install State: ", objItem.InstallState
print "Name: ", objItem.Name
print "Package Cache: ", objItem.PackageCache
print "SKU Number: ", objItem.SKUNumber
print "Vendor: ", objItem.Vendor
print "Version: ", objItem.Version

1 Answer

David Mullet

1/25/2007 5:07:00 PM

0



On Jan 25, 11:41 am, "woodyee" <wood_ye...@hotmail.com> wrote:
> Hi! I was looking over the python scripts for Windows
> (http://www.microsoft.com/technet/scriptcenter/scripts/pyth.......).
> I
> noticed that most are using win32com.client. Is there a similiar
> library for Ruby?
>

require 'win32ole'
objWMIService = WIN32OLE.new("WbemScripting.SWbemLocator")


Mully