Custom actions created with script extensions can generate script code that uses variables. After creating a variable declaration, you can generate code that uses this variable. To generate an expression containing a variable name, follow these steps:
- 
Call the Syntax.CreateInvokemethod to create a newInvokeSyntaxobject.
- 
Specify the variable name in the InvokeNameproperty of the createdInvokeSyntaxobject.
- 
Set the object’s IsPropertyproperty to True.
The resulting InvokeSyntax object can be used to create more complex expressions and statements, for example, assignment statements (see Generating Assignment Statements).
The following example demonstrates how to generate an expression that refers to the MyVar variable:
JScript
function ShowPropertyStatement()
{
    var oVarName = Syntax.CreateInvoke();
    oVarName.InvokeName = "MyVar";
    oVarName.IsProperty = true;
    var strCode = Syntax.GenerateSource(oVarName);
    aqDlg.ShowMessage(strCode);
}
VBScript
Sub ShowPropertyStatement
    Dim oVarName, strCode
    Set oVarName = Syntax.CreateInvoke
    oVarName.InvokeName = "MyVar"
    oVarName.IsProperty = True
    strCode = Syntax.GenerateSource(oVarName)
    aqDlg.ShowMessage strCode
End Sub
See Also
Generating Script Code
Generating Variable Declarations
Generating Object Property Expressions
InvokeSyntax Object
CreateInvoke Method
