Forum Discussion

kandy1984's avatar
kandy1984
Contributor
8 years ago

TC cant find ToolsStripDropDownMenu object in vb script

Hi,

 

Thanks for helping me. I have attached a document of the problem in this ticket. Im not sure if the namemapping which is the one which is playing up. Using the object spy, the popup is named "ToolStripDropDownMenu ". Therefore i used this to write the script to be able to click on one of the item but it is trying to look for the object ToolStripDropDownMenu in run time. Do i have to do anything other thing in the namesmapping to be able to execute the script?

 

The script is as follows:

 

Sub SelectContextMenu()

Call Truck ("Truck 01")
Call ClickMenuItem(Aliases.DataAcquisition.ContextMenuStrip, "Set Primary Status")
Call ClickpopUp (Sys.Process("DataAcquisition").WinFormsObject("ToolStripDropDownMenu", "", 2), "Operating")

End Sub

Function ClickpopUp (menu, path)

Dim i, items, item, found, x, y, point
items = Split(path, "|")
' Find the menu item to click

found = False
For i = 0 To menu.Items.Count - 1
Set item = menu.Items.Item(i)
If item.Text.OleValue = items(0) Then
found = true
Exit For
End If
Next
If Not found Then
Log.Error "The '" & items(0) & "' menu item is not found"
ClickMenuItem = False
Exit Function
End If......

 

..........

............

 

I am waiting to complete my script. Thanks.

 

Sudha.

 

1 Reply

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3

    If you record a test and click on that object, what name does TC give it in the recorded script?