doudou Posted April 23, 2010 Posted April 23, 2010 (edited) Ever wanted to be able to use functions in your AU3 scripts from WSH, VBasic or other COM capable programming language? Well, now it is possible.Please meet: AU3Automation library. It consists of two parts, a COM proxy DLL AU3Aut.dll/AU3Aut64.dll and a small UDF AU3Automation.au3 - both are in the attached archive. Extract the DLL somewhere on your computer (<WinDir>system32 would be a good destination but it is up to you), doregsvr32 AU3Aut.dllresp. on 64-bit systemregsvr32 AU3Aut64.dll(or alternatively just run attached AU3AutRegsiter.au3 script) in the directory, where you extracted it, copy then the UDF files in your AutoIt include directory and start writing automation servers in AU3.Things you can do with AU3AutomationCreate COM server in your plain or compiled AU3 script, in latter case AutoIt doesn't even need to be installed on the target computer to use the server.Export any user defined function.Export any global variable (some types aren't supported, s. exceptions below).Call exported functions or read/write exported variables from any programming language that supports late binding (i.e. "CreateObject").Read all AutoIt @macros from COM clients. Although some macros appear quite pointless in the client context (like dynamic ones: @error, @NumParams, @ScriptLineNumber) but most of them are pretty handy.Things you cannot do with AU3AutomationExport AutoIt built-in functions. A simple UDF wrapper would be exactly as good.Export DllStruct variables or use them as parameter or return type in exported function. No great loss: most of possible clients won't understand them anyway.Access parameters in exported functions ByRef.Raise a specific COM error from within AU3. This is planned in the future, in the meantime you always can export a readonly variable and save error code or description in it (s. example below).Use objects created with AutoItObject in exported variables or return values of exported functions. This is a pity but maybe one day I can convince the AIO team to add marshalling to their great tool.Make coffee, your wife happy and perform brain surgery.Things you shouldn't do with AU3AutomationUse pointers (not even converted to numbers) in exported variables and return values of exported functions. Because the COM server is started in a separate process it has its own address space and all pointers are invalid - thus useless - from the client's perspective.Block the execution of an exported function for to long (f.i. by displaying a MsgBox without timeout). AU3Aut proxy only waits a certain time span for a call to complete and let the client see failure if the call doesn't return in time. The default timeout is 20000 ms and can be set in the client as the second optional parameter of AU3Aut.Load().Use AU3Aut server in ASP or any other networking server application accessible from behind the firewall, it is just to risky.Manufacture weapons of mass destruction.Here's one possible application - a VBScript that uses AU3Script to show "Open File" common dialog.COM server (OpenFileDialog.au3):#include "AU3Automation.au3" _AU3Aut_ExportVariable("title", False, "") _AU3Aut_ExportVariable("initialDir", False, "") _AU3Aut_ExportVariable("filter", False, "All (*.*)") _AU3Aut_ExportVariable("options") _AU3Aut_ExportVariable("defaultName", False, "") _AU3Aut_ExportVariable("error", True) _AU3Aut_ExportFunction("Show") If Not _AU3Aut_Publish() Then Exit -1 _AU3Aut_StayAliveWhileInUse() Func Show() Local $result = FileOpenDialog($title, $initialDir, $filter, $options, $defaultName) $error = @error Return $result EndFuncCOM client (OpenFileDialog.vbs):Set scr = WScript.CreateObject("AU3Aut.Scriptlet") Set dialog = scr.Load("OpenFileDialog.au3") dialog.title = "Please Select File" dialog.filter = "Text Files (*.txt)" dialog.options = 1 Or 2 path = dialog.Show() WScript.Echo "OpenFileDialog returned [" & path & "], error was " & dialog.errorSome more usage examples are in the samples archive.RequirementsAutoIt 3.3.4.0 (minimum)AutoItObject 1.0.x (though its core functionality isn't the subject here, it provides OLE tools I was to lazy to write myself )DDEML 1.5.4 (make sure you have at least this version)DownloadAU3Automation 1.0.6AU3Automation_samples 1.0.1Don't forget: HelpersUDFProject Links @ SourceForgeProject homeFilesSource codeTracker Edited May 6, 2013 by doudou mLipok 1 UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
ptrex Posted April 23, 2010 Posted April 23, 2010 @doudou This is the best news I have seen lately in this forum ! I get to test it right away. If I see the time I will provide you a regfree COM dll version. Where you don't need to register it all the time on each machine. Thanks for sharing ! rgds 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
doudou Posted April 23, 2010 Author Posted April 23, 2010 This is the best news I have seen lately in this forum ! You are exaggerating, my dear. I deeply appreciate your benevolent kindness nonetheless. If I see the time I will provide you a regfree COM dll version. Where you don't need to register it all the time on each machine.The proxy has to be registered one way or the other, otherwise the client wouldn't know how to CreateObject("AU3Aut.Scriptlet"). CoCreateInstance() is a pedantic beast. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
ptrex Posted April 23, 2010 Posted April 23, 2010 The proxy has to be registered one way or the other, otherwise the client wouldn't know how to CreateObject("AU3Aut.Scriptlet"). CoCreateInstance() is a pedantic beast.I don't think so RegFreeCOM Au3X Example Rgdsptrex 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
doudou Posted April 23, 2010 Author Posted April 23, 2010 I don't think so RegFreeCOM Au3X Example I know what you mean, however, COM isolation is only suitable for clients that are compiled with a manifest referencing specific components. You can't use it with pure scripting clients but only in an application that has exclusive privilege to use AU3Aut on the target system.Of course, it is a perfect solution if you have a standalone app that needs to be distributed along with some AU3 scripts which it (and no one else) calls at runtime. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
Shafayat Posted April 24, 2010 Posted April 24, 2010 This is Godly. I'm currently testing it. I must say I'm am impressed! Keep up the good work. [Not using this account any more. Using "iShafayet" instead]
ptrex Posted April 24, 2010 Posted April 24, 2010 @doudoua standalone app that needs to be distributed along with some AU3 scriptsThat is what au3 is about isn't it ? Anyhow good job so far !rgdsptrex 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
doudou Posted April 25, 2010 Author Posted April 25, 2010 I must say I'm am impressed!Keep up the good work.Anyhow good job so far !Thanks for your encouraging support, guys. I thought a new release would be a worthy answer So I made it (s. top post). UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
JRSmile Posted April 27, 2010 Posted April 27, 2010 (edited) brilliant, if you now can add a feature like "__GetMeCoke" i would marry you. Edited April 27, 2010 by JRSmile $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
doudou Posted April 27, 2010 Author Posted April 27, 2010 brilliant, if you now can add a feature like "__GetMeCoke" i would marry you.This feature is already built in but you have to transfer 2 USD to Coca Cola Corp. every time you use it.Sorry, I cannot marry you: my other 3 wives and 4 husbands voted against. But your proposal certainly honors me. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
trancexx Posted April 27, 2010 Posted April 27, 2010 You are using open with ShellExecuteExW. This means it doesn't work for me for scripts.Nice one doudou. ā”ā”ā” . eMyvnE
doudou Posted April 27, 2010 Author Posted April 27, 2010 You are using open with ShellExecuteExW. This means it doesn't work for me for scripts.What verb is registered on your system to run .au3?ShellExecuteEx with "open" seemed to be most universal (as it works for compiled EXE too). Any suggestions? UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
doudou Posted April 27, 2010 Author Posted April 27, 2010 Run Lola run.Hmm... I suppose I could try NULL UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
doudou Posted April 27, 2010 Author Posted April 27, 2010 Especially for trancexx and people who mess with their registries: version 1.0.2 (s. top post) of the DLL executes AU3s no matter what verb is associated with them. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
JRowe Posted April 28, 2010 Posted April 28, 2010 (edited) Hmm, LuaCOM and this means AutoIt based Scite GUI mods - anyone want to take a whack at how that would work out? I'm not very fluent in Lua. Edited April 28, 2010 by JRowe [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
doudou Posted April 28, 2010 Author Posted April 28, 2010 (edited) Hmm, LuaCOM and this means AutoIt based Scite GUI mods - anyone want to take a whack at how that would work out? I'm not very fluent in Lua. The correct link is LuaCOM. I'm not firm in LUA either nor I use SCite but since LuaCOM supports this: luacom_obj = luacom.CreateObject(ProgID) You should be able to use AU3Aut from there (as long as LuaCOM wouldn't try to do GetTypeInfo on it - I don't think so and it should be documented somewhere on their site anyway). But don't ask me about details on Lua libraries integration in Scite... Edited April 28, 2010 by doudou UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
JRowe Posted April 28, 2010 Posted April 28, 2010 Thanks, I think this is one for the general forum. Excellent UDF, I foresee many valuable uses. Thanks! Also, good catch. That prepended http bites me in the ass quite often. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
JRowe Posted May 8, 2010 Posted May 8, 2010 (edited) I got the DLL registered by using the full path to AU3Aut.dll , but now the vbs test doesn't work. Any thoughts on this? Edited May 8, 2010 by JRowe [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
doudou Posted May 8, 2010 Author Posted May 8, 2010 I got the DLL registered by using the full path to AU3Aut.dll , but now the vbs test doesn't work. Any thoughts on this?What do you mean "doesn't work"? What script and what does WSH say? UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
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