private String useSystemVariables(String s) {
		int iosp = model.getIndexOfSelectedParticle();
		s = replaceAll(s, "%mouse_x", mouseLocation.x);
		s = replaceAll(s, "%mouse_y", mouseLocation.y);
		s = replaceAll(s, "%keycode", keyCode);
		s = replaceAll(s, "%model_time", model.modelTime);
		s = replaceAll(s, "%timestep", model.getTimeStep());
		s = replaceAll(s, "%recorder_default_length", model.getDefaultTapeLength());
		s = replaceAll(s, "%pote", model.getPotTS());
		s = replaceAll(s, "%kine", model.getKinTS());
		s = replaceAll(s, "%tote", model.getTotTS());
		s = replaceAll(s, "%pot", model.pot);
		s = replaceAll(s, "%kin", model.kin);
		s = replaceAll(s, "%tot", model.tot);
		s = replaceAll(s, "%temperature", model.getTemperature());
		s = replaceAll(s, "%index_of_selected_particle", iosp);
		s = replaceAll(s, "%number_of_particles", model.getNumberOfParticles());
		s = replaceAll(s, "%number_of_obstacles", model.obstacles.size());
		s = replaceAll(s, "%number_of_images", view.getNumberOfInstances(ImageComponent.class));
		s = replaceAll(s, "%number_of_textboxes", view.getNumberOfInstances(TextBoxComponent.class));
		s = replaceAll(s, "%number_of_lines", view.getNumberOfInstances(LineComponent.class));
		s = replaceAll(s, "%number_of_rectangles", view.getNumberOfInstances(RectangleComponent.class));
		s = replaceAll(s, "%number_of_triangles", view.getNumberOfInstances(TriangleComponent.class));
		s = replaceAll(s, "%number_of_ellipses", view.getNumberOfInstances(EllipseComponent.class));
		s = replaceAll(s, "%width", model.boundary.getView().getBounds().width * R_CONVERTER);
		s = replaceAll(s, "%height", model.boundary.getView().getBounds().height * R_CONVERTER);
		s = replaceAll(s, "%loop_count", iLoop);
		s = replaceAll(s, "%loop_times", nLoop);
		s = replaceAll(s, "%cell_x", model.boundary.x * R_CONVERTER);
		s = replaceAll(s, "%cell_y", model.boundary.y * R_CONVERTER);
		s = replaceAll(s, "%cell_width", model.boundary.width * R_CONVERTER);
		s = replaceAll(s, "%cell_height", model.boundary.height * R_CONVERTER);
//		s = replaceAll(s, "%mml", model.outputStr());
		if (model instanceof MolecularModel) {
			s = replaceAll(s, "%number_of_atoms", model.getNumberOfParticles());
			s = replaceAll(s, "%number_of_rbonds", ((MolecularModel) model).bonds.size());
			s = replaceAll(s, "%number_of_abonds", ((MolecularModel) model).bends.size());
			s = replaceAll(s, "%number_of_molecules", ((MolecularModel) model).molecules.size());
			s = replaceAll(s, "%index_of_selected_atom", iosp);
		}
		return s;
	}