Page 1 of 1 1
Topic Options
#85103 - 2002-02-13 12:20 AM COM scripting
Sergie Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 17
Loc: Moscow
Who can explain how to enumerate members, properties, and methods in container.
In other words, how to know properties name and what I can do with the object?
For example, if I get object
$oComputer = getobject("WinNT://$target,computer")
$oUser = $oComputer.getobject("user",$user)
I want to know names of properties and methods. Is there a way to get it programmaticaly?

Sergie
smotienko@datafort.ru

Top
#85104 - 2002-02-12 02:25 PM Re: COM scripting
mvdw Offline
Starting to like KiXtart

Registered: 2001-05-01
Posts: 124
Loc: Voorburg, Netherlands
Hi Sergie,

i have used the following script to determine what properties are available, remember that there are always some default properties/methods that are not listed in this way, they can be found in the sdk documentation.

code:
$usr = GETOBJECT("WinNT://$user",user)
if @error = 0
$rc = $usr.getinfo
$propcount = $usr.propertycount
? "number of properties found: " + $propcount

$property = $usr.next()
while @error = 0 AND $property <> ""
? "Property name :" + $property.name
? "property type :" + $property.adstype
for each $propval in $property.values
$value = $propval
if $property.adstype = 3
? "with the value :" + $value.caseignorestring
endif
if $property.adstype = 7
? "with the value :" + $value.integer
endif
if $property.adstype = 8
? "with the value :" + $value.octetstring
endif
next
$property = $usr.next
loop


should work on most objects

_________________________
rgrds, Maarten

Top
#85105 - 2002-02-12 03:57 PM Re: COM scripting
Sergie Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 17
Loc: Moscow
Hi Maarten,

Thank you Maarten, it worked! (with minor corrections in your code)

--------
Sergie

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.141 seconds in which 0.119 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org