Hello,
I'm using Greenfoot on Mac OSX as user interface to open another program (the program is called CLIPS expert system). I'm able to do it with the following code:
But I also want to pass an argument in the form of a batch file (entitled "runfile.txt") so that when CLIPS opens, I want it to automatically execute the commands I've written in the batch file (such as loading a construct from a file, resetting, running, and exiting CLIPS). I tried the following code but it did not do anything:
Additionally, I tried the following code and it did not do anything either:
Does anyone know how to code what I'm trying to accomplish?
Thanks,
Vic
public void act()
{
if (Greenfoot.mouseClicked (this))
{
try
{
Process process = Runtime.getRuntime().exec("open -a clips");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
public void act()
{
if (Greenfoot.mouseClicked (this))
{
try
{
Process process = Runtime.getRuntime().exec("open -a clips -f runfile.txt");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
public void act()
{
if (Greenfoot.mouseClicked (this))
{
try
{
String[] cmdArray = new String[2];
cmdArray[0] = "open -a clips";
cmdArray[1] = "batch runfile.txt";
Process process = Runtime.getRuntime().exec(cmdArray)
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}