From: Dimitriy V. M. <dvm...@um...> - 2006-06-27 04:02:42
|
Here's what I came up with based on Andy Streich's advice: rundolines() { // Copy selected text String text = textArea.getSelectedText(); // Create a temp file File temp = File.createTempFile("dofilelines", ".do"); // Delete temp file when program exits. temp.deleteOnExit(); // Write to temp file BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write(text); out.close(); // Run the temporary file in Stata String command="C:\\Program Files\\Scripts\\rundo.exe " + "\"" + temp + "\""; exec(command); } rundolines(); |