Auto-start macros

Overview

Auto-start macros enable you to adjust and extend the functions of the LogWeb/Ajax terminal emulation if necessary:

Depending on the task, the auto-start macros are searched for in the corresponding configuration directories:

In the process, different validities are considered:

Default auto-start macros

The basic default configuration in config contains the following auto-start macros:

If necessary, you can copy these files to the corresponding configuration directories, and edit them there. Note that your changes are only applied after the cache has been updated!

However, we recommend against modifying the properties in the auto-start files config/TERMINAL/macro/auto/_default.js.

Mail: lwh.mail.cb

The auto-start file config/_macro/auto/_mail.js defines the function lwh.mail.cb. This function is called up every time print data or other documents for the user are ready for retrieval. This data is usually displayed in a separate window of your browser. You can change the program behavior by modifying this function.

Example:

lwh.mail.cb = function(aURL) {

	// display data in a new window
	var hwd = window.open(aURL, "_blank","width=640,height=480,scrollbars=yes,resizable=yes");

	//suppress default action
	return false;
};
...

5250 PCO entry: lwh.pco

For 5250 terminals only:

The auto-start file config/5250/macro/auto/pco.js defines the function lwh.pco. This file is called up whenever the AS/400 host sends a STRPCCMD command to the 5250 terminal in order to trigger a local action on the client computer.
In this file, you can configure the action to be executed. By default, the browser displays the file indicated by the host.

Example:

lwh.pco = function(type, par) {
	// depends on call type
	switch (type) {
		case -2:		// invalid PCO signature
		case -1:		// not STRPCCMD command
			return true;	// accept default handling (skip PCO screen)
		case 0:			// STRPCCMD, wait = true
		case +1:		// STRPCCMD, wait = false
			//return true;	// accept default handling (skip PCO screen)
			break;			// ask user
	}

	// STRPCCMD: show in browser
	var url = par;

	// url details depend on environment
	if (false) {
		// make system specific url from PCO command: 2006-10-04/GB
		url = par[1] + "?dokId=" + par[2] + "&dokPool=" + par[3];
	} else {
		// let user decide about correct url
		var msg = "Received PCO STRPCCMD, wait=" + (type > 0) + ":\n" +
			par.join("\n") +	// show command verbs
			"\nPlease adjust URL (or CANCEL)";
		// suggest url from command verbs
		//url.splice(0, 1);	// remove 1st param ("AS400webstart")
		url = url.join(" ");
		url = window.prompt(msg, url);
	}

	// show adjusted url in browser, if any
	if (url) {
		lw.log2("lwh.pco: start browser with url=" + url);
		window.open(url);
		return true;	// accept default handling (skip PCO screen)
		// skip this screen
		//lwk.send("<ENTER>");
		//return false;
	}

	// accept default handling (skip PCO screen)
	return true;
};
...