+//This Function allows the user to run a batchfile containing several commands on mothur
+bool ScriptEngine::getInput(){
+ try {
+
+ string input = "";
+ string commandName = "";
+ string options = "";
+
+
+ //CommandFactory cFactory;
+ int quitCommandCalled = 0;
+
+ while(quitCommandCalled == 0){
+
+ input = getNextCommand(listOfCommands);
+
+ if (input == "") { input = "quit()"; }
+
+
+ mothurOutEndLine();
+ mothurOut("mothur > " + input);
+ mothurOutEndLine();
+
+
+ //allow user to omit the () on the quit command
+ if (input == "quit") { input = "quit()"; }
+
+ CommandOptionParser parser(input);
+ commandName = parser.getCommandString();
+ options = parser.getOptionString();
+
+ if (commandName != "") {
+
+ //executes valid command
+ CommandFactory cFactory;
+ Command* command = cFactory.getCommand(commandName, options);
+ quitCommandCalled = command->execute();
+ }else {
+ mothurOut("Invalid.");
+ mothurOutEndLine();
+ }
+
+ }
+
+ return 1;
+ }
+ catch(exception& e) {
+ errorOut(e, "ScriptEngine", "getInput");
+ exit(1);
+ }
+}
+/***********************************************************************/
+string ScriptEngine::getNextCommand(string& commandString) {
+ try {
+ string nextcommand = "";
+
+ nextcommand = commandString.substr(0,commandString.find_first_of(';'));