WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Arrays
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ObjectType Error 1690 Ole Unable to Perform Enumeration of the Specified Object

 Keywords:  Arrayize Empty ObjectType Error 1690 OLE Unable Perform Enumeration Specified Object Safe Array Variant

Question:

See following example ...
   arrNodes = ObjectType ("ARRAY", Arrayize ("1", @TAB))
   ForEach intNode In arrNodes
      ; do something
   Next

   arrNodes = ObjectType ("ARRAY", Arrayize ("", @TAB)) ; Error 1690.
   ForEach intNode In arrNodes
      ; do something
   Next
Is it possible to change the internal code behaviour of the function ObjectType in relation to the type "ARRAY", so that the script does not run into the error 1690?

Answer:

"ObjectType" is doing exactly what you ask. It is creating an safe array variant with no elements which cannot be enumerated for obvious reasons.

The error is actually caused by the empty array generated by the "Arrayize" function and is related to the fact that WinBatch's list implementation does not make it possible to distinguish between an empty list and a list of one empty item. That subject has already been flogged to death.

If a change were to be made to the "ObjectType" function, it would be to cause the function to error when you attempt to create an empty safe array. The COM Automation specification for safe array's states that element types of VT_EMPTY and VT_NULL are not valid. "ObjectType" currently fudges this by creating a no element safe array with an element type of "VT_VARIANT" but this element type setting is not the cause of the enumeration error. The fact that the array has no elements is the cause of that error.


Article ID:   W17663
Filename:   ObjectType Error 1690 Ole Unable to Perform Enumeration of the Specified Object.txt
File Created: 2011:12:20:10:23:24
Last Updated: 2011:12:20:10:23:24