Local variables can be queried and set within the script (either the foreground or background of that page) using the following functions:


GetLocalVariable

Queries the value of a local variable

SetLocalVariable 

Sets the value of a local variable


Both functions take as their first parameter the name of the variable to be queried or set as the second parameter and the variable containing the value to set or in which to return the value read. The return code function provides information on the outcome of the operation.



Important: Since the background scripts are executed on the server station, setting or reading of local variables in the script of background queries or sets the values ​​of the variables related exclusively to the server!



Example:


Option Explicit


Sub Main ()

    'Reads the current user and

    'Displays the result using message box


    Const LV_USER = "$ User" 'Variable name 


    Dim rc As Long          'ReturnCode

    Dim szUser As String    'Name User current


    'Question of variable

    rc = GetLocalVariable(LV_USER, szUser)


    'Checking the ReturnCode


    If rc = False Then

        'Failed to read: show message of error

        MsgBox "Query Failed"

    Else

        'Reading success: Displays current user

        MsgBox szUser 

    End If

End Sub        


For more information about using GetLocalVariable and SetLocalVariable refer to Guide Basic Script.