Server side Javascript procedure that executes a Console Command and inserts the Command's output into an ASP file at the place in the file where the procedure is invoked.
<% aspConsole(); %>
Prerequisites
Must be contained within a file with a .ASP (Active Server Page) extension.
Parameters
None
URL Query String Parameters
Cmnd
A required string value that fully specifies the Console Command to be issued. For example, if a Directory command is to be issued, this must contain the word "directory" followed by the path for the folder of the directory to be displayed plus any command switch settings.
PreTag
A required numeric value that determines if the white space is to be preserved in the output of the Command. If this value is non-zero, each line of output is bounded by a <pre> and </pre> tag and white space is preserved. If this value is 0, white space is not preserved.
Remarks
When this Javascript procedure is encountered in an ASP file, the web server issues the Console Command specified by Cmnd and inserts the Command's output into the ASP file at the point where the procedure was encountered in place of the procedure call. This procedure provides a means for retrieving lists of information that are available via Console Commands.
While this procedure can be used to directly display information, in the controller's standard web pages it is often executed in a background thread and client side Javascripts are used to process this data before it is displayed on the foreground web page.
To simplify the display and processing of the executed Command's output, each line of the Command's output generates a HTML table row of the following form:
<tr>
<td>one_line_of_output_data_from_command</td>
</tr>
or
<tr>
<td><pre>one_line_of_output_data_from_command</pre></td>
</tr>One row of the table is generated for each line of output plus an additional row is generated that contains the Command's exit error code and error message, typically '0, "Success"'.
For flexibility, the Cmnd and PreTag values are specified within the Query String portion of the URL specification that retrieves the ASP file that contains the aspConsole procedure call. The easiest way to define Cmnd and Pretag is to use <input> tags within the <form> tags that retrieve the ASP file. See the example below for an illustration of this process.
Since the Cmnd and PreTag values are specified in the URL Query String, it is not very useful to include more than one instance of the aspConsole procedure in a file.
Examples
The following is a minimal ASP sample file that illustrates how to execute the aspConsole procedure. Save this sequence in a file as /flash/appweb/test2.asp.
<html>
<body>
<table border="0" cellpadding="0" cellspacing="0">
<% aspConsole(); %>
</table>
</body>
</html>The following is a minimal HTML sample file that implements a button that retrieves the "test2.asp" file. In addition, it defines the values of Cmnd and PreTag to execute the command to display the contents of the /flash/config disk folder. Save this sequence in a file as /flash/appweb/test.html.
<html>
<body>
<p><form action="/flash/appweb/test2.asp" method="get" class="center">
<input name="Cmnd" type="hidden" value="directory /flash/config">
<input name="PreTag" type="hidden" value="0">
<input type="submit" value="Show Directory">
</form></p>
</body>
</html>Directly display test.html by specifying its address in a browser. When it is displayed, press the button to retrieve test2.asp and execute the Console Command. The following should be displayed.
robot01.pac
calib01.pac
controller.pac
diomotion01.pac
gpl_vars.pac
0,"Success"
See Also