Shane0000 Posted August 20, 2012 Posted August 20, 2012 Im getting this error in a weird way.Depending on what text I send in a variable autoit errors out or proceeds correctly.The text variable, if it equals a numeric number (1 2 3) passes correctly:$oAcadActDoc.SummaryInfo.GetCustomByKey('1',$tTemp4) ConsoleWrite("$tTemp4:" & $tTemp4 &@CRLF)The text variable, if it equals a Alphabetic number ('One' 'Two') errors out:$oAcadActDoc.SummaryInfo.GetCustomByKey('One',$tTemp4) ;supple the 'Name' get the 'Value' ConsoleWrite("$tTemp4:" & $tTemp4 &@CRLF)Also before AutoIt errors, it churns for about 25secs on the call w/ "One" as a varHere is the data I am pulling:Thanks for any insights.
water Posted August 20, 2012 Posted August 20, 2012 The error code translates to hex 0xC0000005. This means "access violation" according to MSDN. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
trancexx Posted August 20, 2012 Posted August 20, 2012 You are doing something wrong.Run this:ConsoleWrite(ObjName(ObjCreate("AutoCAD.Application"), 4) & @CRLF)...That will get you location of the file with object's interfaces definitions.Then load e.g. with that file and post the result. ♡♡♡ . eMyvnE
Shane0000 Posted August 20, 2012 Author Posted August 20, 2012 (edited) Yeah, I got the Acad Obj so Ill look into that, thank you. expandcollapse popup; ; Works with AutoCad 2012 ; ; IAcadSummaryInfo: IAcadSummaryInfo Interface ; Property values: ; Author = "" ; Comments = "" ; HyperlinkBase = "" ; Keywords = "" ; LastSavedBy = "Main" ; RevisionNumber = "" ; Subject = "" ; Title = "" ; Methods supported: ; AddCustomInfo (2) ; GetCustomByIndex (3) ; GetCustomByKey (2) ; NumCustomInfo () ; RemoveCustomByIndex (1) ; RemoveCustomByKey (1) ; SetCustomByIndex (3) ; SetCustomByKey (2) $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler Dim $oAcad $oAcad = ObjGet("","AutoCAD.Application") If Not IsObj($oAcad) Then $oAcad = ObjCreate("AutoCAD.Application") If NOT IsObj($oAcad) Then msgbox(0,"0010","error capturing autocad") EndIf EndIf $oAcadActDoc = $oAcad.activedocument ;========================================== ; Properties ;========================================== ConsoleWrite("$oAcadActDoc.SummaryInfo.Author" & @TAB & @TAB & $oAcadActDoc.SummaryInfo.Author& @CRLF) ConsoleWrite("$oAcadActDoc.SummaryInfo.Comments" & @TAB & $oAcadActDoc.SummaryInfo.Comments& @CRLF) ConsoleWrite("$oAcadActDoc.SummaryInfo.HyperlinkBase" & @TAB & $oAcadActDoc.SummaryInfo.HyperlinkBase& @CRLF) ConsoleWrite("$oAcadActDoc.SummaryInfo.Keywords" & @TAB & $oAcadActDoc.SummaryInfo.Keywords& @CRLF) ConsoleWrite("$oAcadActDoc.SummaryInfo.LastSavedBy" & @TAB & $oAcadActDoc.SummaryInfo.LastSavedBy& @CRLF) ConsoleWrite("$oAcadActDoc.SummaryInfo.RevisionNumber" & @TAB & $oAcadActDoc.SummaryInfo.RevisionNumber& @CRLF) ConsoleWrite("$oAcadActDoc.SummaryInfo.Subject" & @TAB & $oAcadActDoc.SummaryInfo.Subject& @CRLF) ConsoleWrite("$oAcadActDoc.SummaryInfo.Title" & @TAB & @TAB & $oAcadActDoc.SummaryInfo.Title& @CRLF) ;========================================== ; Methods ;========================================== ; AddCustomInfo (2) Works ; GetCustomByIndex (3) Works - Garbled Data ; GetCustomByKey (2) Works - Garbled Data ; NumCustomInfo () Works ; RemoveCustomByIndex (1) Works ; RemoveCustomByKey (1) Works ; SetCustomByIndex (3) Works ; SetCustomByKey (2) Works ;========================================== ; ; NumCustomInfo () [No Arguments] ; ConsoleWrite("NumCustomInfo " & @TAB & $oAcadActDoc.SummaryInfo.NumCustomInfo& @CRLF) ; ; RemoveCustomByIndex (1) ; (1) Integer ; Index location ; Dim $i = 0 while $oAcadActDoc.SummaryInfo.NumCustomInfo > 0 $oAcadActDoc.SummaryInfo.RemoveCustomByIndex (0) $i += 1 ConsoleWrite("RemoveCustomByIndex " & $i & @CRLF) wend ; ; AddCustomInfo (1,2) ; (1) String ; Key Name ; (2) String ; Value Name ; Dim $sKey1 = '1', $sValue1 = 'Value One' Dim $sKey2 = 'One', $sValue2 = 'Value 2' $oAcadActDoc.SummaryInfo.AddCustomInfo ($sKey1,$sValue1) $oAcadActDoc.SummaryInfo.AddCustomInfo ($sKey2,$sValue2) ConsoleWrite("AddCustomInfo" & @CRLF) ; ; SetCustomByIndex (1,2,3) ; (1) Integer ; Index location ; (2) String ; Key Name ; (3) String ; Value Name ; For $i = 0 to $oAcadActDoc.SummaryInfo.NumCustomInfo -1 $oAcadActDoc.SummaryInfo.SetCustomByIndex ($i,$i,$i) ConsoleWrite("SetCustomByIndex " & $i & @CRLF) Next ; ; SetCustomByKey (1,2) ; (1) String ; Key Name ; (2) String ; Value Name ; $oAcadActDoc.SummaryInfo.SetCustomByKey ('0','new data') ConsoleWrite("SetCustomByKey" & @CRLF) ; ; RemoveCustomByKey (1) ; (1) String ; Key Name ; $oAcadActDoc.SummaryInfo.RemoveCustomByKey('0') ConsoleWrite("RemoveCustomByKey" & @CRLF) ; ; GetCustomByIndex (1,2,3) ; (1) Integer ; Index location ; (2) String ; Key Name Container for return from AutoCad Returns Garbled Data ; (3) String ; Value Name Container for return from AutoCad Returns Garbled Data ; dim $sKeyContainer_1 dim $sValueContainer_1 For $i = 0 to $oAcadActDoc.SummaryInfo.NumCustomInfo -1 $oAcadActDoc.SummaryInfo.GetCustomByIndex($i,$sKeyContainer_1,$sValueContainer_1) ConsoleWrite("GetCustomByIndex " & $i & @TAB & "Key:" & $sKeyContainer_1 &@CRLF& " Value:" & $sValueContainer_1 & @CRLF) Next ; ; GetCustomByKey (1,2) ; (1) String ; Key Name ; (2) String ; Value Name Container for return from AutoCad Returns Garbled Data ; dim $sValueContainer_2 $oAcadActDoc.SummaryInfo.GetCustomByKey('1',$sValueContainer_2) ConsoleWrite("GetCustomByKey" & @TAB & @TAB & "Value:" & @TAB & $sValueContainer_2 &@CRLF) ;ConsoleWrite(VarGetType($sValueContainer_2) & @CRLF) ;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ Com Error Handler ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ Func MyErrFunc() Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) Local $err = $oMyError.number If $err = 0 Then $err = -1 SetError($err) Endfunc Edited August 20, 2012 by Shane0000
trancexx Posted August 20, 2012 Posted August 20, 2012 You are using latest stable version of AutoIt, right? ♡♡♡ . eMyvnE
Shane0000 Posted August 20, 2012 Author Posted August 20, 2012 (edited) Wow , tried to post the whole thing but Firefox crashed. And im runnng the latest AutoIt 3.3.8.1 Both of these returns are giving me problems. I saw that this could be used in dll manipulation, How does one know what dll to call ? 18. STDCALL FUNC PUREVIRTUAL; HRESULT GetCustomByIndex( [in] int Index, [out] BSTR* pKey, [out] BSTR* pValue ); 19. STDCALL FUNC PUREVIRTUAL; HRESULT GetCustomByKey( [in] BSTR key, [out] BSTR* pValue ); COM code uses the BSTR to store a Unicode string, short for "Basic String". (So called because this method of storing strings was developed for OLE Automation, which was at the time motivated by the development of the Visual Basic language engine.) Here is the whole output from the table functionAutoCad table.txt Edited August 20, 2012 by Shane0000
trancexx Posted August 20, 2012 Posted August 20, 2012 Looks like an old bug on our side. Can I have the file to look for my self? ♡♡♡ . eMyvnE
Shane0000 Posted August 20, 2012 Author Posted August 20, 2012 (edited) Here you go.Thanks for the time / info.Oh yeah, the returns look like:Acad_SummaryInfo.au3 Edited August 20, 2012 by Shane0000
trancexx Posted August 20, 2012 Posted August 20, 2012 I meant the dll. Never mind, I know what's wrong. Will be fixed for next release. Thank you for your cooperation. Shane0000 1 ♡♡♡ . eMyvnE
Shane0000 Posted August 21, 2012 Author Posted August 21, 2012 Im not really so fluent with the DLLs, how would I tell what DLL that belongs to because id like to try to learn to use some dll calls Thank you much
trancexx Posted August 21, 2012 Posted August 21, 2012 You'll learn don't worry, take your time and enjoy the process. When you eventually do, you will say "OMG, how emberassing. That was really stupid question." ♡♡♡ . eMyvnE
Shane0000 Posted August 21, 2012 Author Posted August 21, 2012 There are no dumb questions and a quest for knowledge should never leave one embarrassed. Everything was over my head until I learned ... Njoy trancexx 1
Solution Shane0000 Posted July 11, 2014 Author Solution Posted July 11, 2014 Thank you for your time and work on resolving this issue. I have revisited some of these scripts and find that most of the functions return as expected.
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