Hi. I need to get on an automation script, the name of this automation script.
Doing this, I could do a generic code to send me an email that indicated this script haven't work.
kind regards
Hi Henri,
Since DMA version 10.5.6, the Engine class contains a private field _scriptName, but unfortunately this isn’t publicly exposed. With reflection however, it’s possible to retrieve the value:
var scriptNameField = typeof(Engine).GetField("_scriptName", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var scriptName = scriptNameField.GetValue(engine) as string;engine.GenerateInformation("Script name: " + scriptName);
Important note:
While this works, it is of course a bit of a workaround and should be used with care. There is no guarantee that this will keep working in future DataMiner versions.
As Jorge already mentioned, you could also submit a new feature suggestion.
Hi Henri,
Currently you will need to define a constant string in your scripts that would hold the name of the script and then use that, there's no way to know in run time the name of the script.
Feel free to create a new DataMiner Feature Suggestions - DataMiner Dojo for that to be available in run time.