In a connector there's a right-click context menu item for adding entries to a table.
Once clicked it opens an popup to fill in 3 parameters.
Is that possible through an automation script?
Probably it is possible with slnet, but I wonder if this has been done before.
Hi Jeroen,
Please find an example below.
public static void CreateClassMap(Engine engine, Element ThisElement, string ClassMapName)
{
int ContextMenuParameterId = 14199;SetDataMinerInfoMessage DmInfoMessage = new SetDataMinerInfoMessage
{
DataMinerID = ThisElement.DmaId,
ElementID = ThisElement.ElementId,
Sa2 = new SA
{
Sa = new string[] {
Guid.NewGuid().ToString(),
"1",
ClassMapName,
"ipv4"
}
},
Uia1 = new UIA
{
Uia = new uint[] {
(uint)ThisElement.DmaId,
(uint)ThisElement.ElementId,
(uint)ContextMenuParameterId
}
},
What = 287
};Engine.SLNet.SendSingleResponseMessage(DmInfoMessage);
}
Hi all, would like to add that while the answer from Ive is the correct answer to the question here and while it might be the quick win for any situation where the contextMenu code already pre-exists, a more proper solution is to make use of InterAppCalls. More details can be found in my answer to following Q&A: https://community.dataminer.services/question/triggering-context-menu-parameter-from-automation-script/
What does the What = 287 mean? is that an constant to call the context menu?
Hi Gerwin,
That’s indeed a constant value, it shouldn’t be changed.
If you want to get the full details on the 287, please take a look at this page:
https://docs.dataminer.services/develop/api/NotifyTypes/NT_ALL_TRAP_INFO.html
Hi Jeroen,
It is hard to know what your use case is. It would be nice to explain that as well in your question.
I assume 2 things:
- In C# block of an automation script, there is a context-menu, which consists of a list with predefined code snippets.
- in a running Interactive Automation script, it is not possible to have context-menus directly involved in the UI.
HOWEVER, if you use the UI block type 'Parameter', it will resolve the given parameter data into a parameter control, like the one you see in Data Display.
So this is the same one that you would describe/configure via the protocol.
In your use case, it could be possible if you will pass the table parameter in your script as UI block. Please check the documentation for more information.
Hope this will help you further.
For completeness, I also had to fill in the DataMinerID in the SetDataMinerInfoMessage