private void runScript ( String alias , int levelC ) throws IOException { String scriptFile = alias ; InputStream stream ; try { stream = getInputStream ( scriptFile ) ; if ( stream == null ) { System . out . println ( "Error. Script file is not found: " + scriptFile ) ; return ; } } catch ( IOException e ) { System . out . println ( "Error. Could not load script file " + scriptFile + ": " + e . getMessage ( ) ) ; return ; } final BufferedReader reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; try { doLines ( levelC + 1 , new LineReader ( ) { @ Override public String getNextLine ( String prompt ) throws IOException { return reader . readLine ( ) ; } } , true ) ; } finally { reader . close ( ) ; } }
Run a script . This might go recursive if we run from within a script .