int _FF_ = 13;
char FF = (char)_FF_;
string ut5 = Application.StartupPath ;
string ut4 = ut5 + "/Wizards/Allinone/UCCNC_wizards.exe" ;
string ut1 = ut5 + "/Wizards/Allinone/command.txt" ;
string ut6 = ut5 + "/Wizards/Allinone/adatcsere.txt" ;
string ut7 = ut5 + "/Wizards/Allinone/GetXYZ.txt" ;
string ut8 = ut5 + "/Wizards/Allinone/file.txt" ;
string text1 = "1";
string text2 = "2";
string textend= "kilpve";
string s1 = "1";
string s2 = "2";
string kilep = "";
string beolvas = "L";
string kiolvas = "G";
string kiolvas_text = "";
string tapfile = "";
string XposVal = "";
string YposVal = "";
string ZposVal = "";
double Xposvariable;
double Yposvariable;
double Zposvariable;
string command = "C";
string command_text = "";
	System.Diagnostics.Process proc; 
    System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo(); 
    procInfo.UseShellExecute = true;
    procInfo.FileName = ut4;
    procInfo.Arguments = Application.StartupPath;
    proc = System.Diagnostics.Process.Start(procInfo); 
    System.IO.File.WriteAllText(ut6, text1);
    proc.WaitForExit(50); 
		do
            {
            System.Threading.Thread.Sleep(50);
                String[] lines = System.IO.File.ReadAllLines(ut6);
				String[] tap_file = System.IO.File.ReadAllLines(ut8);
				String[] command_ = System.IO.File.ReadAllLines(ut1);
                System.Console.WriteLine("Contents of adatcsere.txt = ");
                foreach (string tap__file in tap_file)
				{
					tapfile = tap__file;
				}
                foreach (string command__ in command_)
				{
					command_text = command__;
				}
				foreach (string line in lines)
                {
                   kilep = line;
                    if (line == s1)
                    {
                        System.IO.File.WriteAllText(ut6, text2);
                    }
                    if (line == s2)
                    {
                        System.IO.File.WriteAllText(ut6, text1);
                    }
                    if (line == beolvas)
                    {
                        System.IO.File.WriteAllText(ut6, text1);
						exec.mainform.filenametoload =tapfile; 
						exec.mainform.loadfile(); 
					}
                    if (line == kiolvas)
                    {
                        System.IO.File.WriteAllText(ut6, text1);
						XposVal = System.Convert.ToString(Xposvariable = exec.GetXpos());
						YposVal = System.Convert.ToString(Yposvariable = exec.GetYpos());
						ZposVal = System.Convert.ToString(Zposvariable = exec.GetZpos());
						kiolvas_text = XposVal +FF + YposVal + FF + ZposVal;
						System.IO.File.WriteAllText(ut7, kiolvas_text);
					}					
                    if (line == command)
                    {
                        System.IO.File.WriteAllText(ut6, text1);
						exec.Code(command_text);
                    }
				}
            }
            while (kilep != "E");
	System.IO.File.WriteAllText(ut6, textend);