Jump to content
Sign in to follow this  
HansH

How to pass array using com object ?

Recommended Posts

HansH

I am trying to use a com object, but I need to pass an array.

Can't succeed in this somehow, so hopefully some one knows how.

Microsoft documentation says:

Set rs = cn.OpenSchema(adSchemaIndexes, _
         Array(Empty, Empty, Empty, Empty, "Employees")

I have the following code in autoit

Dim $arr[5] = [ "", "" , "", "", "employees" ]
$adSchemaIndexes=12
$adoRs = $adoCon.OpenSchema ($adSchemaIndexes, $arr )

But I get an COMerror 80020009

Any suggestions how to pass those array values ?

Share this post


Link to post
Share on other sites
HansH

Still not able to find a way to solve this, anybody ?

Share this post


Link to post
Share on other sites
MSLx Fanboy

You may just want to try doing $arr[5] = "Employees"

I believe there was a small discussion about initializing arrays in the beta as well, which may or may not be an issue (does it mean NULL when it says Empty?)


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites
HansH

You may just want to try doing $arr[5] = "Employees"

I believe there was a small discussion about initializing arrays in the beta as well, which may or may not be an issue (does it mean NULL when it says Empty?)

<{POST_SNAPBACK}>

Works ! You only must declare $arr[5]="Employees"

If you fill any of the other arrayfields with "" it will do nothing.

Const $adSchemaIndexes=12
Dim  $arr[5]
$arr[5]="Employees"
$adoRs = $adoCon.OpenSchema ($adSchemaIndexes, $arr )

Thx

Share this post


Link to post
Share on other sites
therks

Actually, that should fail. So should this.

Dim $arr[5]
$arr[5] = 'String'

Should get subscript dimension range exceeded (Dim $arr[5] should give you 0, 1, 2, 3, 4 [notice there are 5 values]).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×