|
Executing APG Scripts |
|
See Also: |
APG scripts can be executed programmatically, in any programming environment that supports COM. These topics provide more specific information related to programmatic execution of APG scripts:
We make the assumption here that most developers are familiar with Visual Basic and/or VBScript. All code shown here can be converted to any other programming language that supports COM.
This example, which runs in Visual Basic and in VBScript, illustrates how to programmatically execute an APG script:
Dim oAPGen
Set oAPGen = CreateObject("APGen")
' Place output files in this directory
oAPGen.OutputDir = "C:\InetPub\wwwroot\"
' Run the default.apg script
oAPGen.Run "default.apg"
If you want more control of script execution, then use APGen.OpenScript() to obtain an APGScript object:
Dim oAPGen, oAPGScript
Set oAPGen = CreateObject("APGen")
' Load the script
Set oAPGScript = oAPGen.OpenScript("default.apg")
' Set the script log file
oAPGScript.Log.Filename = "build.log"
' Run the script
oAPGScript.Run
' Run procedure Foo which is defined in the script
oAPGScript.Globals.Foo "param1"
For an example APG script that programmatically runs a
bunch of other APG scripts, see build.apg in the
<install dir>/Examples/awe_apg/apg directory.