0

I have a simple windows form that has a COM user control. This COM user control has method "GetNode" COM methods. I want to test this function call using autohotkey.

Run "C:\AHC_Exploring\Project1.exe"
WinWaitActive, Form1, , 2
if ErrorLevel
{    MsgBox, WinWait timed out.
    return
}

ObjUerControl := ; // Need to know correct get COM object method

lResult = Object.GetNodeId(2)

MsgBox %lResult%

Return
Naresh
  • 658
  • 1
  • 7
  • 22
  • 2
    I'm pretty shure that the methods this object has (like "GetNodeId") are not within the reach of an autohotkey script so this approach won't work. – 576i Oct 11 '13 at 20:03
  • 1
    True, I understood that. Later I switched to VBScript and in the application, I exposed the Objects, that Needed to be Automated. Now, its easy. Thank you for your reply. – Naresh Oct 13 '13 at 03:50
  • Also, there should be one way which we might not have explored. Just becasue of time unavailability, I am not exploring. GetNodeId is a COM function and ObjUserControl is COM user Control. AutoHotKey allows CreateObject, and On that Created object, it allows calling of GetNodeId function. In the case, Instead of creating, we have to know the Getting handle of an existing COM object. – Naresh Oct 13 '13 at 03:51
  • As a comment. I only used cOM objects with the internet explorer to remote control it. For this to work, I had to start it with the command `Pwb := ComObjCreate("InternetExplorer.Application")` to get a handle which then is used to commanicate with the brwoser. I have not seen a way to get the objects of something I started using the `run` command. – 576i Oct 13 '13 at 10:03
  • What if you had to write a script to an application that already has InternetExplorer.Application in it. What would be your Pwb := ComXXXX("InternetExplorer.Application") statement – Naresh Oct 14 '13 at 13:26

1 Answers1

0

You can use ComObjActive to get a handle to a COM object that is already running.

Michael
  • 1,263
  • 1
  • 12
  • 28