#128285 - 2004-10-22 12:02 PM
IDispatch pointers not allowed in expressions!
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
Hi,
Can see several have had problems with IDispatch pointers not allowed in expressions! But I've been unable to find any solutions. Here's my code:
FUNCTION mailbox($getou) $mailbox=GETOBJECT("LDAP://$getou") ? "getobj @serror" ? "User Information:" ? "Display Name: " $mailbox.get("cn") ? "Given Name: " $mailbox.get("givenname") ? "Last Name: " $mailbox.get("sn") ? "Alias: " $mailbox.get("uid")
ENDFUNCTION
FUNCTION getOU($userName)
DIM $dn,$objRootDSE,$strDomain DIM $objConnection,$objCommand DIM $objRecordSet $getOU = "Not Found" $objRootDSE = GETOBJECT("LDAP://RootDSE") $strDomain = $objRootDSE.Get("DefaultNamingContext") $objConnection = CREATEOBJECT("ADODB.Connection") $objConnection.Open ("Provider=ADsDSOObject;") $objCommand = CREATEOBJECT("ADODB.Command") $objCommand.ActiveConnection = $objConnection $objCommand.CommandText = "<LDAP://" + $strDomain + ">;((saMAccountName=" + $userName + "))" + ";distinguishedName,name;subtree"
$objRecordSet = $objCommand.Execute
WHILE Not $objRecordSet.EOF $dn = $objRecordSet.Fields("distinguishedName").Value $getOU = $dn $objRecordSet.MoveNext LOOP
mailbox($getou)
ENDFUNCTION
BREAK on
? "Enter username: " GETS $username
getOU($username)
Hope someone can help me
|
Top
|
|
|
|
#128288 - 2004-10-22 03:54 PM
Re: IDispatch pointers not allowed in expressions!
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
That's the hole error text I have given you. It's stops with last line in the function mailbox, but if I comment the line, it just moves up a line. I've tried to comment everything except the first "$mailbox=GETOBJECT("LDAP://$getou")" and I stille got the error
Hope this answers your question
|
Top
|
|
|
|
#128289 - 2004-10-22 04:02 PM
Re: IDispatch pointers not allowed in expressions!
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
Btw,
" "getobj @serror"" says it's successfully
Jan
|
Top
|
|
|
|
#128292 - 2004-10-25 11:03 AM
Re: IDispatch pointers not allowed in expressions
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
Yes I tried but it didn't fixed my problem
|
Top
|
|
|
|
#128293 - 2004-10-25 11:05 AM
Re: IDispatch pointers not allowed in expressions!
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
I'm using ver 4.21.
It does say which line the problem is, but if I comment that line the problem move 1 line up until I have comment every line then it does give any errors
|
Top
|
|
|
|
#128296 - 2004-10-25 02:11 PM
Re: IDispatch pointers not allowed in expressions!
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
Hi,
If I run 4.22 I get this error: In-page IO exception occurred. This type of exception is thrown by the Windows Memory Manager when it fails to (re)read code from the KiXtart executable. Common causes for this exception include: -running WKIX32 from a batchfile without using START /w -forced redirection of the network drive from which KiXtart was started -severe network errors/latency -faulty anti-virus software
If I use wkix32 I get the same "IDispatch pointers not allowed in expressions!" error in a window
|
Top
|
|
|
|
#128299 - 2004-10-25 02:25 PM
Re: IDispatch pointers not allowed in expressions!
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
Hi,
I get the same error :-(
Now Itried to run it in debug mode and to my big surprise the gives the error when doing DIM.....: DIM $dn,$objRootDSE,$strDomain DIM $objConnection,$objCommand
When it DIM's the secondline I get the error: In-page IO exception occurred. This type of exception is thrown by the Windows Memory Manager when it fails to (re)read code from the KiXtart executable. Common causes for this exception include: -running WKIX32 from a batchfile without using START /w -forced redirection of the network drive from which KiXtart was started -severe network errors/latency -faulty anti-virus software
If I use Wkix32 it works
What is the different between kix32 and wkix32?
|
Top
|
|
|
|
#128301 - 2004-10-25 02:43 PM
Re: IDispatch pointers not allowed in expressions
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
I did a re-download and I got the same problem. Tried to download the latest devel. build, but that's a dead link
It seems that it doesn't likes my DIM's in the function "getOU" and that's a new problem
"Help me! Obi-Wan-Kenobi"
|
Top
|
|
|
|
#128302 - 2004-10-25 02:47 PM
Re: IDispatch pointers not allowed in expressions
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
Top
|
|
|
|
#128303 - 2004-10-25 02:53 PM
Re: IDispatch pointers not allowed in expressions
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
It's WORKING!!!!!
I just rebooted my pc. Must be something with my McAfee that did something crappy because it was stopped working and after I rebooted it worked again and now I could run the scripts
Thanks a lot for your help. You are all my heros
|
Top
|
|
|
|
#128304 - 2004-10-25 03:09 PM
Re: IDispatch pointers not allowed in expressions
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Cannot test here (don't have the infrastructure), but try this: Code:
Break ON $=SetOption("Explicit","ON") $=SetOption("WrapAtEOL","ON") Dim $sUser Dim $oMailBox "Enter username: " GetS $sUser $oMailBox=udfGetMailBox(udfGetOU($sUser)) If @ERROR udfError("while attempting to get mailbox") EndIf Exit 0 Function udfGetMailbox($sOU) If Not $sOU Exit @ERROR EndIf $mailbox=GetObject("LDAP://"+$sOU) If @ERROR udfError("getting mailbox") Exit @ERROR EndIf EndFunction Function udfGetOU($sUserName) Dim $dn,$objRootDSE,$strDomain Dim $objConnection,$objCommand Dim $objRecordSet $udfGetOU="" $objRootDSE = GetObject("LDAP://RootDSE") If @ERROR udfError("getting RootDSE") Exit @ERROR EndIf $strDomain = $objRootDSE.Get("DefaultNamingContext") $objConnection = CreateObject("ADODB.Connection") If @ERROR udfError("creating ADODB connection") Exit @ERROR EndIf $objConnection.Open("Provider=ADsDSOObject;") If @ERROR udfError("opening ADODB provider") Exit @ERROR EndIf $objCommand = CREATEOBJECT("ADODB.Command") If @ERROR udfError("creating ADODB command") Exit @ERROR EndIf $objCommand.ActiveConnection = $objConnection $objCommand.CommandText = "<LDAP://" +$strDomain +">;((saMAccountName=" +$sUserName +"))" +";distinguishedName,name;subtree" $objRecordSet = $objCommand.Execute While Not $objRecordSet.EOF $dn = $objRecordSet.Fields("distinguishedName").Value $udfGetOU = $dn $objRecordSet.MoveNext Loop EndFunction Function udfError($s) "ERROR: While "+$s+@CRLF "Reason: ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndFunction
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 436 anonymous users online.
|
|
|