private String useTextBoxVariables(String s) {
		int n = view.getNumberOfInstances(TextBoxComponent.class);
		if (n <= 0)
			return s;
		int lb = s.indexOf("%textbox[");
		int rb = s.indexOf("].", lb);
		int lb0 = -1;
		String v;
		int i;
		TextBoxComponent text;
		while (lb != -1 && rb != -1) {
			v = s.substring(lb + 9, rb);
			double x = parseMathExpression(v);
			if (Double.isNaN(x))
				break;
			i = (int) Math.round(x);
			if (i < 0 || i >= n) {
				out(ScriptEvent.FAILED, "Text box " + i + " does not exist.");
				break;
			}
			v = escapeMetaCharacters(v);
			text = view.getTextBox(i);
			s = replaceAll(s, "%textbox\\[" + v + "\\]\\.x", text.getRx() * R_CONVERTER);
			s = replaceAll(s, "%textbox\\[" + v + "\\]\\.y", text.getRy() * R_CONVERTER);
			s = replaceAll(s, "%textbox\\[" + v + "\\]\\.width", text.getWidth() * R_CONVERTER);
			s = replaceAll(s, "%textbox\\[" + v + "\\]\\.height", text.getHeight() * R_CONVERTER);
			s = replaceAll(s, "%textbox\\[" + v + "\\]\\.angle", text.getAngle());
			lb0 = lb;
			lb = s.indexOf("%textbox[");
			if (lb0 == lb) // infinite loop
				break;
			rb = s.indexOf("].", lb);
		}
		return s;
	}