private String useLineVariables(String s) {
		int n = view.getNumberOfInstances(LineComponent.class);
		if (n <= 0)
			return s;
		int lb = s.indexOf("%line[");
		int rb = s.indexOf("].", lb);
		int lb0 = -1;
		String v;
		int i;
		LineComponent line;
		while (lb != -1 && rb != -1) {
			v = s.substring(lb + 6, rb);
			double x = parseMathExpression(v);
			if (Double.isNaN(x))
				break;
			i = (int) Math.round(x);
			if (i < 0 || i >= n) {
				out(ScriptEvent.FAILED, "Line " + i + " does not exist.");
				break;
			}
			v = escapeMetaCharacters(v);
			line = view.getLine(i);
			s = replaceAll(s, "%line\\[" + v + "\\]\\.x1", line.getX1() * R_CONVERTER);
			s = replaceAll(s, "%line\\[" + v + "\\]\\.y1", line.getY1() * R_CONVERTER);
			s = replaceAll(s, "%line\\[" + v + "\\]\\.x2", line.getX2() * R_CONVERTER);
			s = replaceAll(s, "%line\\[" + v + "\\]\\.y2", line.getY2() * R_CONVERTER);
			lb0 = lb;
			lb = s.indexOf("%line[");
			if (lb0 == lb) // infinite loop
				break;
			rb = s.indexOf("].", lb);
		}
		return s;
	}