void write() throws ScriptException {
		if (viewer.isApplet())
			evalError(GT._("The {0} command is not available for the applet.", "WRITE"));
		int tok = (statementLength == 1 ? Token.clipboard : statement[1].tok);
		int pt = 1;
		String type = "SPT";
		switch (tok) {
		case Token.script:
			pt++;
			break;
		case Token.identifier:
			type = ((String) statement[1].value).toLowerCase();
			if (type.equals("image"))
				pt++;
			else type = "image";
			break;
		}
		if (pt == statementLength)
			badArgumentCount();

		// write [image|script] clipboard

		if ((tok = statement[pt].tok) == Token.clipboard) {
			viewer.createImage(null, type, 100);
			return;
		}

		// write [optional image|script] [JPG|JPG64|PNG|PPM|SPT] "filename"
		// write script "filename"

		if (pt + 2 == statementLength) {
			type = ((tok == Token.identifier ? (String) statement[pt].value : stringParameter(pt))).toUpperCase();
			if (";JPEG;JPG64;JPG;PDF;PNG;SPT;".indexOf(";" + type + ";") < 0)
				evalError(GT._("write what? {0} or {1} \"filename\"", new Object[] { "SCRIPT|IMAGE CLIPBOARD",
						"JPG|JPG64|PNG|PPM|SPT" }));
		}
		String fileName = null;
		switch (statement[statementLength - 1].tok) {
		case Token.identifier:
		case Token.string:
			fileName = (String) statement[statementLength - 1].value;
			break;
		default:
			invalidArgument();
		}
		viewer.createImage(fileName, type, 100);
	}