Script

 

Remarks Properties Methods DynProperties Samples

ED
avaliable
RT
read only

Remarks:Top

If several functions should be combined and be executed in the defined order (similar to a batch file), they can be entered into a script.

Properties:Top

Count Name Parent

Methods:Top

Add Item Remove

DynProperties:Top

Name Type Description
Name String

Name

Unique name of the script.
Default: Script_x (where x is a consecutive number).
The name can be freely defined, but there are pre-defined names for scripts that should be executed automatically. These names can be selected or typed in:
AUTOSTART: The script will be executed automatically at the start of Runtime operation (standalone resp. server) and before activation of the start picture (at standalone resp. server), if the project is the Runtime start project.
AUTOEND: The script will be executed automatically at the end of Runtime operation (standalone resp. server), if the project is the Runtime start project.
AUTOSTART_CLIENT: The script will be executed automatically at the start of Runtime operation on a client and before activation of the start picture on a client, if the project is the Runtime start project.
AUTOEND_CLIENT: The script will be executed automatically at the end of Runtime operation on a client, if the project is the Runtime start project.
AUTOSTART_SRVPROJ: The script will be executed automatically at the start of Runtime operation on the PC, that is the server of the project, before activation of the start picture, if the project is not the Runtime start project.
AUTOEND_SRVPROJ: The script will be executed automatically at the end of Runtime operation on the PC, that is the server of the project, if the project is not the Runtime start project.

ATTENTION: This property is not available for language switching.

Read more in the online manual

Samples:Top

Sub zenOn_ScriptExample()
	'**************** Use this code in the editor ****************

	Dim zScript As Script
	Dim i As Integer

	'Initialize the script object with the first script in the scripts object (list)
	Set zScript = MyWorkspace.ActiveDocument.Scripts.Item(0)

	'If there is no script available (no script in the scripts object),...
	If zScript Is Nothing Then
		'...then inform the user
		MsgBox ("No Script available")
	'otherwise:
	Else
		'Output the name of the script
		Debug.Print "Scriptname: " & zScript.Name
	
		'For every function in the script...
		For i = 0 To zScript.Count - 1
			'...output the name of the function
			Debug.Print i + 1 & ". Function: " & zScript.Item(i).Name
		Next i
	
		'Add the picSTART function to the script
		zScript.Add (MyWorkspace.ActiveDocument.RtFunctions.Item("picSTART").ID)
	
		'Remove the picSTART function from the script
		zScript.Remove (MyWorkspace.ActiveDocument.RtFunctions.Item("picSTART").ID)
	End If
End Sub