Navigation: Scripting Reference Manual > Functions & Subroutines > DeleteGlobalVar

 

DeleteGlobalVar

 

Contact Us: fredsupport@photonengr.com

 

Description

This subroutine deletes a global script variable from the document.

 

 

Syntax

DeleteGlobalVar id

 

 

Parameters

id As Long

ID number of the global script variable to be deleted.  If ID number is invalid, the script is halted with an error message.

 

 

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

FindGlobalVar

GetGlobalVar

GetGlobalVarCount

GetGlobalVarValue

SetGlobalVar

SetGlobalVarValue

 

 

 

 

 

Copyright © Photon Engineering, LLC