collections
Heiko Selber <[email protected]>
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
I am trying to access the items of a collection, or to create a
Enumeration for the collection, but don't seem to get anywhere.
If I am wasting bandwidth with a stupid question, please simply point me
to some stuff to read.
In detail, I want to find out the properties of drives. I have managed to
get this far with a lot of trial and error:
DispatchPtr fso = new DispatchPtr("Scripting.FileSystemObject");
DispatchPtr drives = (DispatchPtr) fso.get("Drives");
According to http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/script56/html/jscoldrives.asp the next step would be to create an
Enumeration over drives, but I cannot seem to do it.
I tried to mimick some approaches the I found on this list to access
individual members, but failed with various errors, e.g.:
Object[] drives = (Object[]) drives.invokeN("Item",
new Object[] { new Integer(i) });
I am completely lost here, because I am not experienced with Windows
scripting. The Jawin javadoc is not much help, either.
I know that the collection has a property named Count that matches the
expected number of items:
Integer numDrives = (Integer) drives.get("Count");
Thanks in advance,
Heiko Selber
PS: It seems that this question was already posted to the list over a year
ago, but never answered:
> Date: Fri, 21 Nov 2003 11:30:43 -0500
> From: Ken Larson <[email protected]>
> Subject: collections
> I am trying to deal with a com class that returns a collection from a
> method. I see there is some code in jawin to help deal with collections
> and enumerations, but I am not sure how complete it is or how exactly to
> use it.
> Can anyone give me any pointers as to how I would access a collection
> (and also logically, an enumeration) using jawin?
> Thanks,
> Ken Larson