Navigation: Scripting Reference Manual > Functions & Subroutines > GetGlobalVarCount

 

GetGlobalVarCount

 

Contact Us: fredsupport@photonengr.com

 

Description

This function returns the number of global script variables defined in the document.

 

 

Syntax

numVars = GetGlobalVarCount( )

 

 

Parameters

numVars ( Long )

Returned number of global script variables in the document.  Global script variables are referenced from 0, so the maximum global script id is GetGlobalVarCount()-1.

 

 

Example

The following example prints out information for all global script variables, checks a specific variable for existence in the document and either deletes it or prints it's status to the output window.

 

          Dim ii As Long

          Dim varName As String, varComment As String

          Dim varVal As Variant

 

          ClearOutputWindow

 

          'get the starting number of variables, loop over each and print its information

          Print  "There are " & GetGlobalVarCount() & " global script variables in the document at start."

          Print "Current variables are: "

          For ii = GetGlobalVarCount()-1 To 0 Step -1

                    GetGlobalVar ii, varName, varVal, varComment

                    Print Chr(9) & varName & " = " & varVal & " ( " & varComment & " ) "

          Next ii

 

          'check if a variable exists in the document and delete or print status

          ii = FindGlobalVar( "g_temp" )

          If ii > 0 Then

                    DeleteGlobalVar ii

                    Print "There are " & GetGlobalVarCount() & " global script variables in the document after deletion of g_temp."

          Else

                    Print "g_temp not found, document was not modified."

          End If

 

 

See Also

Global Script Variables

AddGlobalVar

DeleteGlobalVar

FindGlobalVar

GetGlobalVar

GetGlobalVarValue

SetGlobalVar

SetGlobalVarValue

 

 

 

 

 

 

Copyright © Photon Engineering, LLC