title: Set a variable value in Kofax Total Agility from JAVA
body: <p>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. </p>
  
  <p>When exciting this specific part of the process I want to set a value to an output variable for example : sp.InputVariables["[Document.Status]"]. </p>
  
  <p>How can I set a conditional value depending on the Process or send back a value with Java ? </p>
  
  <p>Here is my C# code : </p>
  
  <pre><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();
              }
    }
   }
  }
  </code></pre>