Hello,
This should be simple but so far I am striking out. I have a function that will search the current form for a button that I pass in as a variable:
function FindBtn(BtnName) // Pass in Name of Control { var btn,p; p = Sys.Process("M3.AKShell"); var PropName = "Name"; // Reference the control's Name property var PropValue = BtnName; // The Name property value for the control btn = p.findChild(PropName,"WinFormsObject(" + PropValue + ")",200000,true); // Look for the button on the current form if (btn.exists) {
Log.Message(btn.Name + " was successfully found"); return btn.FullName; } else { Log.Error("The " + BtnName + " button was not found"); } }
This seems to work well. I can follow along and see that it finds the control I am looking for. I am then trying to call the button's ClickButton event, which is not working. No error is returned, the log shows the steps as passing. Here is my calling function:
function clickContactTab() { var VndrBtn; VndrBtn = FindBtn(APContactTab); VndrBtn["ClickButton"]();//<--This line is not working }
I can see that the FullName is returned to the calling function, however, I am receiving the error:
Object doesn't support this property or method
and the button is never actually clicked. What am I missing?