I Kofax Total Agility I created a C# basic script that calls an external java application by creating a process and passing a string parameter.
When exciting this specific part of the process I want to set a value to an output variable for example : sp.InputVariables["[Document.Status]"].
How can I set a conditional value depending on the Process or send back a value with Java ?
Here is my C# code :
using System;
using System.Diagnostics;
using System.IO;
using Agility.Server.Scripting.ScriptAssembly;
namespace MyNamespace
{
public class Class1
{
public Class1()
{
}
[StartMethodAttribute()]
public void Method1(ScriptParameters sp)
{
string parameter =sp.InputVariables["[Facture.InstanceID]"].ToString();
Console.WriteLine("Parameter " + parameter);
using (Process process = new Process())
{
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.FileName = "java";
process.StartInfo.Arguments = @"-jar C:\\jars\\application.jar " + parameter;
process.Start();
StreamReader reader = process.StandardOutput;
string output = reader.ReadToEnd();
process.WaitForExit();
}
}
}
}