public String loadScriptResource(String filename, String charset)
	{
		BufferedReader br = null;
		try 
		{
			br = new BufferedReader(new InputStreamReader(
					new FileInputStream(filename),
					charset
				));
		
		} catch( IOException | NullPointerException e1 ) {
			// no file found try to load from jar
			try 
			{
				br = new BufferedReader(new InputStreamReader(
						getClass().getClassLoader().getResourceAsStream(filename),
						charset
					));
				
			} catch( Exception e2 ) {
				// both loading tries failed
				// so no script file is available
				ApplicationLogger.logError("Script " + filename + " not found!");
				return null;
			}
		}
		try 
		{
			StringBuilder sb = new StringBuilder();
			String line;
		
			while(( line = br.readLine()) != null ) 
			{
				sb.append(line);
				sb.append("\n");
			}
			br.close();
			return sb.toString();
			
		} catch( IOException e ) {
			ApplicationLogger.logError(e);
		}
		return null;
	}