I want to get script outputs from the script executed from the connector.
I sent ExecuteScriptMessage from the connector and got response as ExecuteScriptResponseMessage.
After the script executed successfully, check the response.ScriptOutput but always got empty dictionary.
How to get script outputs from the script?
You can make use of the Skyline.DataMiner.Core.DataMinerSystem.Automation (for automation scripts) or make use of the Skyline.DataMiner.Core.DataMinerSystem.Protocol (from protocols) NuGet libraries.
For example:
IDms thisDms = protocol.GetDms(); OR IDms thisDms = engine.GetDms();
var script = thisDms.GetScript("MyScriptName");
var parameters = new DmsAutomationScriptParamValue[] { };
if (script.Parameters.Any(p => p.Description.Equals("Input", StringComparison.InvariantCultureIgnoreCase)))
{
parameters = new DmsAutomationScriptParamValue[] { new DmsAutomationScriptParamValue("Input", "Input parameter") };
}
var results = script.Execute(parameters, new DmsAutomationScriptDummyValue[] { });
var outputText = results.ScriptOutput["outputName"];
I’ll look into the library if we can improve/extend the classes to support a wider variety of scripts. For now, you could put this code in a try-catch, so you can avoid your code failing in case it is not a c# script.
Thank you Michiel-san.
I added the try-catch code temporarily.
Hi Michiel-san,
Thank you for the prompt reply.
It worked as expected with NuGet libs.
But GetScript() failed if the script is not C# script.
This connector handles not only C# script but also simple ‘Set’ script. (In this case, we don’t need script output of course.)
Any solution for these?