APGen Documentation Previous Topic: Include Directive Next Topic: APGen Object Reference Parent Topic: APG Script Syntax Reference    APG Script Syntax Reference
@LANGUAGE Directive
See Also:

<%# @LANGUAGE=<lang> #%>

Sets the default scripting language for the APG script.

Syntax

<%# @LANGUAGE= JScript | VBScript | others #%>

Directive Description
LANGUAGE= JScript | VBScript | others

Specifies the script language for this APG script.

JScript The scripting language is JScript.
VBScript The scripting language is VBScript.
others Third-party scripting languages can be used within APGen. See Using Other Script Languages for more information.

Notes

The <%# @LANGUAGE=... #%>directive is placed at the beginning of an APG script to specify the default scripting language for the script.  All code within APG script brackets, and all output expressions, are executed using this scripting language.  The SCRIPT tag can specify a different language for its contents.

The <%# @LANGUAGE=... #%> directive, if used, must occur before any script or content blocks.

If the <%# @LANGUAGE=... #%> directive is not used at the beginning of an APG script, the default scripting language is obtained from the registry setting:

Key: HKEY_LOCAL_MACHINE\SOFTWARE\WebGecko\APGen\Defaults
String Value: "Language"

When APGen is installed, this value is set to "VBScript".  Thus, VBScript is the default scripting language.

Example

Below is an APG script that uses the @LANGUAGE directive, and mixes script languages.  Note that this demo follows the recommended practice (discussed in Mixing Script Languages) of avoiding any global script or content when languages are mixed:

<%# @LANGUAGE=JScript #%>
<SCRIPT RUNAT=APGen LANGUAGE=VBScript>


Sub WriteVBSInfo
     Output.Write ScriptEngine & " Version " & _
                    ScriptEngineMajorVersion & "." & _
                    ScriptEngineMinorVersion & _
                    " Build " & ScriptEngineBuildVersion
End Sub

</SCRIPT>
<%#

function WriteJSInfo()
     {
     Output.Write(ScriptEngine() + " Version " +
                    ScriptEngineMajorVersion() + "." +
                    ScriptEngineMinorVersion() +
                    " Build " + ScriptEngineBuildVersion() );
     }
     
// Writes information about both script
// engine versions.
function Main()
     {
     // Set output file
     Output.Filename = "Script_Vers.txt";
     
     // Note that we're calling a VBScript fn from JScript
     WriteVBSInfo();
     
     // Write a return, followed by a divider
#%>
---------------------------------------------
<%#

     WriteJSInfo();     
     }
#%>

This script produces the following output file (Script_Vers.txt) :

VBScript Version 5.0 Build 3715
---------------------------------------------
JScript Version 5.0 Build 3715