public void exec() throws ConsoleException {
		String filename = this.parameters.get(FILE_PARAM);
		if ((filename == null) || (filename.length() == 0)) {
			throw new ConsoleException(FILE_PARAM + " parameter is missing!");
		}
		String timesString = this.parameters.get(TIMES_PARAM);
		int times = 1;
		if (timesString != null && timesString.length() != 0) {
			try {
				times = Integer.parseInt(timesString);
			} catch (NumberFormatException e) {
				throw new ConsoleException(TIMES_PARAM + " is not a valid number!");
			}
		}
		if (times < 1) {
			times = 1;
		}
		this.out.println("Trying to open macro file '" + filename + "'.");
		int linesRead = 0;
		try {
			this.out.println("Executing macro " + times + " time(s).");
			for (int i = 0; i < times; i++) {
				this.out.println(i);
				FileReader fileInput = new FileReader(filename);
				BufferedReader reader = new BufferedReader(fileInput);
				String line = reader.readLine();
				linesRead++;
				while (line != null) {
					CommandFactory factory = ConsoleThread.getConsole()
							.getCommandFactory();
					this.out.println("MACRO EXECUTION: Line read from file: '"
							+ line + "'.");
					Command cmd = factory.createCommand(line);
					this.out.println("MACRO EXECUTION: Executing command "
							+ cmd.getCommandName());
					cmd.execute();
					line = reader.readLine();
					linesRead++;
				}
				linesRead = 0;
				reader.close();
				fileInput.close();
			}

		} catch (IOException e) {
			throw new ConsoleException(
					"IO error while reading macro file. Lines "
							+ "read successfully: " + linesRead + ". In round "
							+ times + ".Message: " + e.getMessage());
		}
	}