mac2000 Posted May 23, 2010 Share Posted May 23, 2010 Hi, need some help from guru of autoit here is my really simple script: #include <Word.au3> $w = _WordCreate() When i execute it, get error: --> Word.au3 Error from function _WordDocAdd, $_WordStatus_InvalidObjectType Enviroment: Windows 7, Office 2010 beta, Autoit 3.3.6.1 What is really strange, that on one pc with same enviroment all works fine, but on other do not work I there any suggestions, or maybe way to debug or get more description of what going wrong? Link to comment Share on other sites More sharing options...
mac2000 Posted May 23, 2010 Author Share Posted May 23, 2010 okay, so problem is not in word.au3 it is somewhere in COM $w = ObjGet("","Word.Application") if @error then MsgBox(0,"",@error) exit endif at moment trying to run this and get error, is there any way to get more info about what is going wrong? Link to comment Share on other sites More sharing options...
mac2000 Posted May 23, 2010 Author Share Posted May 23, 2010 For those who will get same errors as i, here is example from autoit documentation:Global $g_eventerror = 0 ; to be checked to know if com error occurs. Must be reset after handling. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler ; Performing a deliberate failure here (object does not exist) $oIE = ObjCreate("Word.Application") $oIE.visible = 1 $oIE.bogus if $g_eventerror then Msgbox(0,"","the previous line got an error.") Exit ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) $g_eventerror = 1 ; something to check for when this function returns Endfuncget error code 80020006 and description Unknown nameas about enviroment, there are just one differnce between is translation of windows, on one pc it is english, on other it is russian, so maybe problems come from here... Link to comment Share on other sites More sharing options...
mac2000 Posted May 23, 2010 Author Share Posted May 23, 2010 found where problem occursin word.au3 there is many checks like this: __WordIsObjType($o_object, "application")in that function they get ObjName and check it to be equal to _Applicationand here is where problem occurs: in my case ObjName return empty string and error Link to comment Share on other sites More sharing options...
mac2000 Posted May 23, 2010 Author Share Posted May 23, 2010 seems to be autoit bughere is code:$w = ObjCreate("Word.Application") $w.visible = True if @error then Msgbox(0,"","ObjCreate " & @error) EndIf If Not IsObj($w) Then MsgBox(0,"","$w is not obj") EndIf if @error then Msgbox(0,"","IsObj " & @error) EndIf $on = ObjName($w) if @error then Msgbox(0,"","ObjName " & @error) EndIf msgbox(0,"",$on ) $w.Quit(-2,1,0)expecting to get message with object namebut recieve message ObjName 1 Link to comment Share on other sites More sharing options...
kilian14 Posted December 14, 2011 Share Posted December 14, 2011 Hi mac2000, How did you solve your problem? I am having the same problem you had: some kind of COM error. I have two PCs both with OFFiCE 2010, one of the PCs words perfectly and the other doesn´t. Thanks Felippe Kilian Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now