Hi Eddie / YN / Franz,
Thank you for your helpful guidance.
@Franz, totally agree with your concerns. But my support team uses some assembly lines on regular basis and sometimes they have so many of them open that they get mixed up and accidents happen. I am trying to provide just a stop gap solution so that some assembly lines are not run unintentionally.
I have used a small VB script to prompt users when they are about to run an assembly line that could restart some appliances.
In case my solution helps someone, following is the VB script I have used. I have placed this VB script in the solution directory and have named it messageBox.vbs
Set objArgs = WScript.Arguments
messageText = objArgs(0) + " " + objArgs(1) + " " + objArgs(2) + "?"
result = MsgBox (messageText,4)
WScript.Echo result
I have added a property with keyword promptScript and value messageBox.vbs to the project specific property file.
The VB script is tightly tied with the following code snippet I have written in my assembly lines
var applName = work.getString("applName");
var fixPackLevel = work.getString("fixLevel");
var promptScript = system.getExternalProperty("promptScript");
var cmdStr = "cmd /c cscript " + promptScript + " \" Are you sure you want to install fixpack \"" + fixPackLevel + " on " + applName;
task.logmsg("INFO","***************************************************");
task.logmsg("INFO","Are you sure you want to install fixpack " + fixPackLevel + " on " + applName + "?");
task.logmsg("INFO","***************************************************");
var cmd = system.shellCommand(cmdStr);
if (cmd.getOutputBuffer().contains("6")){
task.logmsg("INFO","***************************************************");
task.logmsg("INFO","User clicked Yes when prompted, continuing with the assembly line");
task.logmsg("INFO","***************************************************");
} else if (cmd.getOutputBuffer().contains("7")){
task.logmsg("INFO","***************************************************");
task.logmsg("INFO","User clicked No when prompted, aborting the assembly line");
task.logmsg("INFO","***************************************************");
system.abortAssemblyLine("User clicked No when prompted, aborting the assembly line");
}
I am a beginner at TDI, so am not suggesting that this is the only or the best way to trigger prompts. This is only my humble attempt and it works for me. I would be happy to discuss any improvement.