Andreik Posted December 12, 2015 Posted December 12, 2015 Yes, the server script is running and you are right, sp_OACreate is more like ObjCreate from AutoIt and creates an instance of an object instead to create a reference to the existing object from AutoIt Server. I don't know if SQL Server have something similar to ObjGet. It would be such great way to access AutoIt with so many possibilities.
mikester Posted July 17, 2019 Posted July 17, 2019 I know this is an old thread but I came across it and this could be a HUGE help to what I'm doing, except I can't quite get it working. I want to automate a windows application that uses wpf and winforms so I was using CUIAutomation2.au3 by junkew and that worked great. Now I have a need to integrate this into another testing tool that can use Java, Python, or C#. Our dev team uses C# so I was leaning in that direction. Anyways, using this com server approach I was able to launch our application but when I tried to call functions like GetRootElement and FindFirst, I couldn't quite figure out the syntax. Here's a code sample: dynamic myAu3Object = Marshal.BindToMoniker("AutoIt.Application"); // Create UI Automation object dynamic oUIAutomation = myAu3Object.Call("ObjCreateInterface", "$sCLSID_CUIAutomation", "$sIID_IUIAutomation", "$dtagIUIAutomation"); // Get Desktop element dynamic pDesktop = null; myAu3Object.Call("oUIAutomation.GetRootElement", pDesktop); var oDesktop = myAu3Object.Call("ObjCreateInterface", pDesktop, "$sIID_IUIAutomationElement", "$dtagIUIAutomationElement"); I don't believe pDesktop gets filled properly b/c if I write out oDesktop to the console it always returns '1'. I've tried a bunch of variations of the syntax but can't quite wrap my head around the proper way to do it, or if it's even possible. I'm still learning AutoIt and have very little knowledge of C# so I'm a bit over my head but would dive right in if I knew it could work. It looks like both of those functions set the value of a variable sent to them but I'm not sure I have access to those values back in C#. Can anyone confirm that? If more details are needed please let me know. My alternative is to create a bunch of small au3 scripts, convert them to exe files and call them externally but I was hoping to avoid that if I could. Any help would be greatly appreciated!
swoop Posted May 18, 2021 Posted May 18, 2021 Does anyone know how to access AutoIt from Golang using trancexx's Access AutoIt method? I saw some COM helpers in a Go-OLE/COM library at: https://github.com/go-ole/com/blob/fd770a131a7ed4c177a3f011a989ed3647331887/com/com.go func BindMoniker(moniker uintptr, option int32, interfaceID *GUID, object interface{}) error { return api.BindMoniker(moniker, option, interfaceID, object) } And also this one: // CoGetClassObject in Windows API. func CoGetClassObject() { return api.CoGetClassObject() } In a language like Python, it seems simple with just: oAutoIt = win32com.client.GetObject("AutoIt.Application") oAutoIt.Call("Sleep", 3000) Or in C#: dynamic myAu3Object = Marshal.BindToMoniker("AutoIt.Application"); myAu3Object.Call("Sleep", 1000); Any help would be greatly appreciated.
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