stuartc1 Posted October 16, 2007 Share Posted October 16, 2007 Hi, I'm looking for a way communicate with a ocx control and not sure if this can be donw with autoit. Please let me know if this is possible and any pointers would be great. many thanks Link to comment Share on other sites More sharing options...
stuartc1 Posted October 16, 2007 Author Share Posted October 16, 2007 I've can connect with the object using: $oOpos = ObjCreate("OPOS.POSPrinter"); But is there a way send functions? For example in the docs for the OCX Control, there is a function like: PrintImmediate(PTR_S_JOURNAL, 'hello'); I've attempted to use: $oOpos.PrintImmediate(PTR_S_JOURNAL, 'hello'); - but get an error. Is it possible to pass functions to the object? Sorry for the questions, I've not use AutoIt for a while and never used it to communicate with thried part OCX controls. Link to comment Share on other sites More sharing options...
ptrex Posted October 16, 2007 Share Posted October 16, 2007 @stuartc1I don't know this specific OCX what it does.But looking at the Error syntax you mentioned the error is related to the following :1. $oOpos.PrintImmediate(PTR_S_JOURNAL, 'hello'); -> should be between "PTR_S_JOURNAL" or2. $oOpos.PrintImmediate(PTR_S_JOURNAL, 'hello'); -> should be a Variable / constant $PTR_S_JOURNALI hope this helpsregards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
stuartc1 Posted October 16, 2007 Author Share Posted October 16, 2007 thanks ptrex for your suggestion, I updated it to include the quotes, but it still failed. I guess the problem is with the control. The error I get is: 'The requested action with this object has failed' Is there a generic way to request exposed methods on an object? (is there a way to find out which methods an object supports?) Link to comment Share on other sites More sharing options...
ptrex Posted October 16, 2007 Share Posted October 16, 2007 (edited) @stuartc1 Yes there is. In my signature you will find a Typlib browser. But unfortunately is is still in a Beta stage. Give it a try. As will you can add the COM Error event routine in you script; Initialize error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Your code goes here ;------------------------------ This is a COM Error handler -------------------------------- Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Error 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 & $HexNumber & @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 _ ) SetError(1) ; to check for after this function returns Endfunc I hope this will get you started. BTW what does the OCX do exactly ? regards ptrex Edited October 16, 2007 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
stuartc1 Posted October 16, 2007 Author Share Posted October 16, 2007 thanks for the tips ptrex, I'll try them now. The OCX is used by POS (Point of Sale) software to access a receipt printer. I need to communicate with the printer via the OCX to print my own stuff. Link to comment Share on other sites More sharing options...
ptrex Posted October 16, 2007 Share Posted October 16, 2007 @stuartc1 Oeps it was not yet in my signature. so I updated it. Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New 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