ranber Posted May 3, 2018 Share Posted May 3, 2018 Hi ~ I have a OCX file and its IDL like below: expandcollapse popup// Generated .IDL/C++ pseudo source equivalent of Win32 type library ..\CZEMApi.ocx [ uuid({71BD42C1-EBD3-11D0-AB3A-444553540000}), version(1.0), helpstring("CZ EM API OLE Control") ] library APILib { // Forward references and typedefs dispinterface _EMApi; dispinterface _EMApiEvents; [ uuid({71BD42C2-EBD3-11D0-AB3A-444553540000}), helpstring("Dispatch interface for CZ EM API Control") ] dispinterface _EMApi { properties: [id(0), bindable, requestedit] BSTR Caption; methods: [id(0)] long Set( BSTR lpszParam, VARIANT* vValue); [id(1)] long Get( BSTR lpszParam, VARIANT* vValue); [id(2)] long Execute(BSTR lpszCommand); [id(3)] long Initialise(BSTR lpszMachine); [id(4)] long Grab( short xoff, short yoff, short width, short height, short reduction, BSTR lpszFilename); [id(5)] long GetStagePosition( VARIANT* x, VARIANT* y, VARIANT* z, VARIANT* t, VARIANT* r, VARIANT* m); [id(6)] long MoveStage( single x, single y, single z, single t, single r, single m); [id(7)] long SetNotify( BSTR lpszParameter, long bNotify); [id(8)] long GetLastError(VARIANT* Error); [id(9)] long ClosingControl(); [id(10)] long GetLimits( BSTR lpszParam, VARIANT* vMinValue, VARIANT* vMaxValue); [id(11)] long GetMulti( BSTR lpszParam, VARIANT* vValues); [id(12)] long SetMulti( BSTR lpszParam, VARIANT* vValues); [id(13)] long GetVersion(short* Version); [id(14)] long InitialiseRemoting(); [id(15)] long GetCurrentUserName( BSTR* strServerUserName, BSTR* strNTUserName); [id(16)] long GetUserIsIdle(long* bUserIsIdle); [id(17)] long GetLastRemotingConnectionError(BSTR* strLastConnectionError); [id(18)] long SetSuppressRemotingConnectionErrors(); [id(19)] long LogonToEMServer( BSTR lpszUserName, BSTR lpszUserPassword); [id(20)] long StartEMServer(); [id(21)] long MoveStageDoubles( double x, double y, double z, double t, double r, double m); [id(22)] void AboutBox(); }; [ uuid({71BD42C3-EBD3-11D0-AB3A-444553540000}), helpstring("Event interface for CZ EM API Control") ] dispinterface _EMApiEvents { properties: methods: [id(0)] void Notify( BSTR lpszParameter, long Reason); [id(1)] void NotifyWithCurrentValue( BSTR lpszParameter, long Reason, long paramid, double dLastKnownValue); }; [ uuid({71BD42C4-EBD3-11D0-AB3A-444553540000}), helpstring("CZ EM API Control") ] coclass Api { [default] dispinterface _EMApi; [default, source] dispinterface _EMApiEvents; }; }; My autoit code like: ; CZ EM API OLE Control Local Const $CLSID_API = "{71BD42C4-EBD3-11D0-AB3A-444553540000}" Local $CZEMApi=ObjCreate($CLSID_API) If Not IsObj($CZEMApi) Then MsgBox(4096,"Failed to create APILib.Api object","You may need to run regsvr32 CZEMApi.ocx :error=" & Hex(@error,8)) Exit Else ;MsgBox(4096,"info","success") EndIf $Notify = ObjEvent($CZEMApi,"EMApiEvents_") Func EMApiEvents_Notify($parameter,$reason) MsgBox(4096,"Notify", "Event catchall for " & $parameter & @TAB & $reason & @CR) EndFunc $CZEMApi.Caption = "for test" MsgBox(4096,"caption",$CZEMApi.Caption) Local $long = $CZEMApi.InitialiseRemoting() Local $pVAR = "" Local $result = $CZEMApi.Get("AP_MAG",Ptr($pVAR)) But issue is: "G:\test.au3" (79) : ==> The requested action with this object has failed.: Local $result = $CZEMApi.Get("AP_MAG",Ptr($pVAR)) Local $result = $CZEMApi^ ERROR How to fixed this issue? Link to comment Share on other sites More sharing options...
ranber Posted May 3, 2018 Author Share Posted May 3, 2018 I try the VBScript code is ok, Dim Api1 Set Api1 = CreateObject("CZ.EMApiCtrl.1") call Api1.InitialiseRemoting() call Api1.Get("AP_MAG",Value) call WScript.Echo("Magnification = " + CStr(Value)) Link to comment Share on other sites More sharing options...
Developers Jos Posted May 3, 2018 Developers Share Posted May 3, 2018 1 hour ago, ranber said: I try the VBScript code is ok, .. and what about this script?: $Api1 = ObjCreate("CZ.EMApiCtrl.1") $Api1.InitialiseRemoting() $value=$Api1.Get("AP_MAG") ConsoleWrite("Magnification = " & $value & @CRLF) Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 14 hours ago, Jos said: .. and what about this script?: $Api1 = ObjCreate("CZ.EMApiCtrl.1") $Api1.InitialiseRemoting() $value=$Api1.Get("AP_MAG") ConsoleWrite("Magnification = " & $value & @CRLF) Jos [id(1)] long Get( BSTR lpszParam, VARIANT* vValue); Get() Method has no [out,retval] attribute, I tried it get same failed. Link to comment Share on other sites More sharing options...
trancexx Posted May 4, 2018 Share Posted May 4, 2018 (edited) And something obvious like this fails too? Local $vVAR Local $result = $CZEMApi.Get("AP_MAG", $vVAR) Edited May 4, 2018 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 I need Autoit Gui feature and more other features, and VBS can't supplied. Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 16 minutes ago, trancexx said: And something obvious like this fails too? Local $vVAR Local $result = $CZEMApi.Get("AP_MAG", $vVAR) Thanks for your reply, I tried it get same error. "G:\test.au3" (66) : ==> The requested action with this object has failed.: Local $result = $CZEMApi.Get("AP_MAG",$pVAR) Local $result = $CZEMApi^ ERROR Link to comment Share on other sites More sharing options...
trancexx Posted May 4, 2018 Share Posted May 4, 2018 You need COM error handler initialized to get more info about the error. ObjEvent is the function for this too. Post the details you get. This should work. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 8 minutes ago, trancexx said: You need COM error handler initialized to get more info about the error. ObjEvent is the function for this too. Post the details you get. This should work. $oMyError = ObjEvent("AutoIt.Error","_ErrFunc") ; Istall a custom error handler ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Get COM error is: test.au3 (82) : ==> COM Error intercepted ! err.number is: 0x80020005 err.windescription: ÀàÐͲ»Æ¥Åä¡£ err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 82 err.retcode is: 0x00000000 Link to comment Share on other sites More sharing options...
mLipok Posted May 4, 2018 Share Posted May 4, 2018 34 minutes ago, ranber said: ÀàÐͲ»Æ¥Åä¡£ Could you translate this ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 35 minutes ago, mLipok said: Could you translate this ? Type mismatch. Link to comment Share on other sites More sharing options...
mLipok Posted May 4, 2018 Share Posted May 4, 2018 (edited) @trancexx I'm not sure .... but I think that I read somewhere that AutoIt not support for ByRef in ActiveX objects . Am I right ? Edit: Second question: Is it related to this user case ? Edited May 4, 2018 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted May 4, 2018 Share Posted May 4, 2018 (edited) @ranber Try this: Local $vVAR = Binary(0) Local $result = $CZEMApi.Get("AP_MAG", $vVAR) Local $vVAR = Binary("") Local $result = $CZEMApi.Get("AP_MAG", $vVAR) Edited May 4, 2018 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 13 minutes ago, mLipok said: @ranber Try this: Local $vVAR = Binary(0) Local $result = $CZEMApi.Get("AP_MAG", $vVAR) Local $vVAR = Binary("") Local $result = $CZEMApi.Get("AP_MAG", $vVAR) Thanks for your help, it also failed. Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 34 minutes ago, mLipok said: @trancexx I'm not sure .... but I think that I read somewhere that AutoIt not support for ByRef in ActiveX objects . Am I right ? Edit: Second question: Is it related to this user case ? Maybe your right, the autoit no support for ByRef in ActiveX objects. Link to comment Share on other sites More sharing options...
trancexx Posted May 4, 2018 Share Posted May 4, 2018 4 hours ago, mLipok said: @trancexx I'm not sure .... but I think that I read somewhere that AutoIt not support for ByRef in ActiveX objects . Am I right ? Edit: Second question: Is it related to this user case ? The code I wrote did support it. I don't know if something was changed afterwards. However, I did leave small bug with initialization and intention to fix it during beta testing. Something that never happened. The bug was such that randomly execution would fail. But random isn't always. mLipok 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
mLipok Posted May 4, 2018 Share Posted May 4, 2018 This explains a lot. Thanks. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 37 minutes ago, trancexx said: The code I wrote did support it. I don't know if something was changed afterwards. However, I did leave small bug with initialization and intention to fix it during beta testing. Something that never happened. The bug was such that randomly execution would fail. But random isn't always. I tried all methods with parameter of VARIANT* ,float*, BSTR* also get same "Type mismatch" error. Link to comment Share on other sites More sharing options...
mLipok Posted May 4, 2018 Share Posted May 4, 2018 @ranber Could you post any link to some kind documentation for this object ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
ranber Posted May 4, 2018 Author Share Posted May 4, 2018 (edited) 21 minutes ago, mLipok said: @ranber Could you post any link to some kind documentation for this object ? $oMyError = ObjEvent("AutoIt.Error","_ErrFunc") ; Istall a custom error handler ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc ; CZ EM API OLE Control Global $CZEMApi=ObjCreate("CZ.EMApiCtrl.1") If Not IsObj($CZEMApi) Then MsgBox(4096,"Failed to create APILib.Api object","You may need to run regsvr32 CZEMApi.ocx :error=" & Hex(@error,8)) Exit EndIf $Notify = ObjEvent($CZEMApi,"EMApiEvents_") Func EMApiEvents_Notify($parameter,$reason) MsgBox(4096,"Notify", "Event catchall for " & $parameter & @TAB & $reason & @CR) EndFunc $CZEMApi.InitialiseRemoting() Local $x,$y,$z,$r,$t,$m Local $result = $CZEMApi.GetStagePosition($x,$y,$z,$r,$t,$m) Get error: >"D:\Program Files\AutoIt3\SciTE\..\AutoIt3.exe" "D:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "G:\test.au3" /UserParams +>21:02:19 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00000804 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0804) CodePage:0 utf8.auto.check:4 +> SciTEDir => D:\Program Files\AutoIt3\SciTE UserDir => C:\Users\ranber\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\ranber\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) from:D:\Program Files\AutoIt3 input:G:\test.au3 +>21:02:19 AU3Check ended.rc:0 >Running:(3.3.14.5):D:\Program Files\AutoIt3\autoit3.exe "G:\test.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop test.au3 (75) : ==> COM Error intercepted ! err.number is: 0x80020005 err.windescription: Type mismatch. err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 75 err.retcode is: 0x00000000 oIt3.e+>21:02:29 AutoIt3.exe ended.rc:0 +>21:02:29 AutoIt3Wrapper Finished. >Exit code: 0 Time: 11.69 Edited May 4, 2018 by ranber 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