Michel Claveau Posted September 5, 2007 Share Posted September 5, 2007 (edited) Hi! (sorry for my bad english) Thanks to . AutoIt team. Piccaso for WM_COPYDATA usage. Livewire for the DLL for use Memory-Mapped-File in AutoIt. Python team. Mark Hammond for PyWin32It's not a really COM-server in AutoIt.It's limited.In the fact, it's a dynamic server COM, in Python, which makes bridge with a special Autoit windowNeed : Python (2.4 or 2.5) see: http://www.python.org/download/ (choose windows-installer) or: http://www.ponx.org/download/CD/Python/python-2.5.1.msi PyWin32 see: http://sourceforge.net/project/platformdow...?group_id=78018 or: http://www.ponx.org/download/CD/Python/pyw...win32-py2.5.exe or ActivePython (from ActiveState) ; this distribution contain Python AND Pywin32 see: http://www.activestate.com/Products/activepython/index.plex autoitmmap.dll (it's my release of the DLL or Livewire (see Autoit-forums))Install: create a directory (I suggest C:\Ponx) copy, in this directory, the file pbautoit.py in command-line, launch pbautoit.py (must answer : Enregistrement du server COM pbridge.autoit version 1.0 Registered: pbridge.autoit ) copy in your disk, pbautoit1.au3 (I suggest C:\Ponx, but it's as you want) in the same directory, copy autoitmmap.dll It's all! Try examples.Principe.When you call a function of the COM-server, pbridge.autoit translate argumentsto strings (in cp1252), and call a windows-message (WM_COPYDATA) to theautoit-window.The "return" problem.pbridge.autoit no have window ; cannot read windows-messages. The way for getreturn values from AutoIt is Memory-Mapped-File (a DLL in AutoIt, mmap modulewith Python)But pbridge.autoit is not trigged, when values are availables. Then pbridge.autoittry after 0.01 second, well each 0.1 second, during 30 s (this timeout will can change).A smart (?) stunt : for call who don't want return values, it's possible toprefix the call(name)) with "NORETURN_" (this prefix is delete, for the internalcall to AutoIt)Others :All call names (functions) are translated in uppercase ; this, because somelanguages don't distinguish case, and COM calls are perhaps upper- or perhaps lower- (forexample VB-script)No TLB (TypeLiBrary) ; it's a dynamic COM server. It's the capability to usefunctions declared after his launch. This is not compatible with static server(& TLB).Possible functions : in theory, any user functions callable into the Autoit-window can be called by the client.But some contraints : all parameters (including Unicode objects) are translatedin string (in cp1252) ; cannot include "|||" (separator) ; max length call :32767 caracters ; don't use esapece in names ; don't use reserved names ; etc.Only one predfined function : autoitload(path,file) load (open) the window of AutoIt-simili-serveur ; try during 5 secondes, then error return : handle of window, or -1 if error examples : a.autoitload("D:\\dev\\autoit","pbautoit1.au3") a.autoitload("C:\\autoit","pbautoit1.exe")See attachment (file pbautoit.zip) Edited September 6, 2007 by Michel Claveau Link to comment Share on other sites More sharing options...
Michel Claveau Posted September 5, 2007 Author Share Posted September 5, 2007 (edited) Some examples of use : in vb script: Set auto = WScript.CreateObject("pbridge.autoit") auto.autoitload "C:\ponx","pbautoit1.au3" auto.message "Azërtyuiop" result = auto.addition(10000,234,432) WScript.Echo CStr(result) result = auto.splashtext("Tittrree","Wouaaaahhh!!! A splash-text.",2000) WScript.Echo CStr(result) auto.noreturn_close() in JScript: auto = new ActiveXObject("pbridge.autoit"); auto.autoitload("C:\\ponx","pbautoit1.au3"); auto.message("Azërtyuiop"); result=auto.addition(10000,234,432); WScript.Echo(result); result=auto.splashtext("Tittrree","Wouaaaahhh!!! A splash-text.",2000); WScript.Echo(result); auto.noreturn_close(); in Python:# -*- coding: cp1252 -*- import win32com.client,time,os,sys aut = win32com.client.Dispatch('pbridge.autoit') aut.autoitload("C:\\ponx","pbautoit1.au3") print aut.message("Azërtyuiop") print aut.addition(10000,234,432) print aut.titi() #this function is undefined (for test Error) print aut.splashtest1() #call with wait aut.noreturn_splashtest1() #same call, but return immediately print "Retour immédiat." #time.sleep(4) #for wait the end a splastest1 print aut.splashtext("Tittrree","Wouaaaahhh!!! A splash-text.",2000) aut.noreturn_close() in HTA (+JScript): expandcollapse popup<hta:application application navigable="yes" windowstate="normal" caption="yes" /> <html> <head><title>Test: Bridge Autoit</title> <script type='text/javascript'> function test(){ self.resizeTo(300,200); self.moveTo(20,10); auto = new ActiveXObject("pbridge.autoit"); auto.autoitload("C:\\ponx","pbautoit1.au3"); result=auto.message("Azërtyuiop"); document.write(result); document.write("<br>"); result=auto.addition(10000,234,432); document.write(result); document.write("<br>"); result = auto.splashtext("Tittrree","Wouaaaahhh!!! A splash-text.",2000); document.write(result); document.write("<br>"); auto.noreturn_close(); } </script> </head> <body bgColor=#eeffff> Test de Bridge Autoit<br> <script type='text/javascript'> setTimeout("test()",100); </script> </body> </html> ...and, why not, in AutoIt: $auto = ObjCreate("pbridge.autoit") $auto.autoitload("C:\\ponx","pbautoit1.au3") $auto.message("Azërtyuiop") $result = $auto.addition(10000,234,432) msgbox(0,"Addition",$result) $result = $auto.splashtext("Tittrree","Wouaaaahhh!!! A splash-text.",1000) msgbox(0,"Addition",$result) $auto.noreturn_close(); Edited September 5, 2007 by Michel Claveau Link to comment Share on other sites More sharing options...
ptrex Posted September 5, 2007 Share Posted September 5, 2007 @Michel ClaveauThis seems a lot like this if I am not mistaken Creating COM objects without a need of DLL'sRegards,Patrick 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...
Michel Claveau Posted September 5, 2007 Author Share Posted September 5, 2007 Hi, ptrex! Sorry, it's little different: it's a true COM-server, with a bridge to a AutoIt-window. The communication ways of the bridge are : message(WM-COPYDATA) for call & Memory-File-Mapped (with a DLL) for get return-values. Link to comment Share on other sites More sharing options...
ptrex Posted September 5, 2007 Share Posted September 5, 2007 @Michel Claveau I agree. Your solution is more solid, but the concept is both the same, trying to create a bridge to AU3 using COM. Good job 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...
Michel Claveau Posted September 5, 2007 Author Share Posted September 5, 2007 Hi! trying to create a bridge to AU3 using COMI agree for my turn. 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