Skip to main content

ModelCenter APIs 2025 R1

ScriptComponent

Last update: 16.07.2025

public class ScriptComponent : Component

This is the wrapper class that handles the native COM calls to a ScriptComponent object.

Author

jboutwell, 8-2011

Properties

Name Summary
COMPONENT_TYPE_ASSEMBLY val COMPONENT_TYPE_ASSEMBLY: String = "Assembly"
COMPONENT_TYPE_COMPONENT val COMPONENT_TYPE_COMPONENT: String = "Component"
COMPONENT_TYPE_EMPTY val COMPONENT_TYPE_EMPTY: String = "Empty"
COMPONENT_TYPE_FOR_EACH val COMPONENT_TYPE_FOR_EACH: String = "ForEach"
COMPONENT_TYPE_IF val COMPONENT_TYPE_IF: String = "If"
COMPONENT_TYPE_LOOP val COMPONENT_TYPE_LOOP: String = "Loop"
COMPONENT_TYPE_PARALLEL val COMPONENT_TYPE_PARALLEL: String = "Parallel"
COMPONENT_TYPE_SCRIPTCOMPONENT val COMPONENT_TYPE_SCRIPTCOMPONENT: String = "ScriptComponent"
COMPONENT_TYPE_SEQUENCE val COMPONENT_TYPE_SEQUENCE: String = "Sequence"

Functions

Name Summary
addVariable public addVariable(name: String, type: String, state: String): Variable
Adds the variable from the script component.
disableGC public disableGC(gc: Boolean)
If true, prevents releaseObjects from doing anything.
downloadValues public downloadValues()
downloads the component's variable values from Analysis Server, if it's an Analysis Server component
getAssociatedFiles public getAssociatedFiles(): Array<Any>
gets the associated files of the component
getForwardSchedule public getForwardSchedule(): Boolean
Gets the state of the script's forward scheduling mode.
getFullName public getFullName(): String
gets the full name of the current object, e.g.
getGroup public getGroup(index: Int): Group
public getGroup(name: String): Group
gets the specified group
getIndexInParent public getIndexInParent(): Int
Gets the index of the component in its parent assembly.
getLanguage public getLanguage(): String
Gets the script's source language.
getMetadata public getMetadata(name: String): Variant
Get a metadata value.
getName public getName(): String
gets the name of the current object, e.g.
getNumGroups public getNumGroups(): Int
get the number of groups stored in this object
getNumVariables public getNumVariables(): Int
get the number of variables stored in this object
getParentAssembly public getParentAssembly(): Assembly
gets the parent assembly of this component (fails if this is the model/root assembly)
getPositionX public getPositionX(): Int
gets the X co-ordinate value of the current object,
getPositionY public getPositionY(): Int
gets the Y co-ordinate value of the current object,
getPrevalidate public getPrevalidate(): Boolean
Gets the state of the script's prevalidate mode.
getSource public getSource(): String
gets the server path for the component, e.g.
getSourceScript public getSourceScript(): String
Gets the source script code associated with this script component.
getTimeout public getTimeout(): Double
Gets the script's run timeout.
getType public getType(): String
gets the type of the component: COMPONENT_TYPE_COMPONENT = "Component" COMPONENT_TYPE_SCRIPTCOMPONENT = "ScriptComponent" COMPONENT_TYPE_ASSEMBLY = "Assembly" COMPONENT_TYPE_SEQUENCE = "Sequence" COMPONENT_TYPE_IF = "If" COMPONENT_TYPE_PARALLEL = "Parallel" COMPONENT_TYPE_EMPTY = "Empty" COMPONENT_TYPE_FOR_EACH = "ForEach"
getUserData public getUserData(): Any
Get user data of the component.
getVariable public getVariable(index: Int): Variable
gets the specified variable
public getVariable(name: String): Variable
gets the specified variable.
invalidate public invalidate()
causes the component to be invalidated
invokeMethod public invokeMethod(method: String)
invokes a method of the Component
reconnect public reconnect()
reconnects the component
release public release()
Releases the COM reference to ModelCenter for this object.
releaseObjects public releaseObjects()
This function attempts to release any COM resources left behind from objects which have been finalized but release() was never called on them.
removeVariable public removeVariable(name: String)
Removes the variable from the script component.
rename public rename(name: String)
Rename the component
run public run()
causes the component to run
setAssociatedFiles public setAssociatedFiles(val: Array<Any>)
sets the associated files of the component
setForwardSchedule public setForwardSchedule(forwardSchedule: Boolean)
Turns on/off the script's forward scheduling mode.
setLanguage public setLanguage(language: String)
Sets the script's source language.
setMetadata public setMetadata(name: String, type: Variable.MetadataType, value: Any, access: Variable.MetadataAccess, archive: Boolean)
Set a metadata value on a component
setPrevalidate public setPrevalidate(prevalidate: Boolean)
Sets the script's prevalidate mode.
setReferenceDebugMode public setReferenceDebugMode(on: Boolean)
When set to true, the system will keep a list of active COM objects that are allocated but not yet released since this method was invoked.
setSourceFromFile public setSourceFromFile(file: String)
Sets the script source code to the value of the given file.
setSourceFromString public setSourceFromString(script: String)
Sets the script source code to the given string.
setTimeout public setTimeout(timeout: Double)
Sets the script's run timeout.
setUserData public setUserData(val: Any)
Set user data of the Component
setVariables public setVariables(inputs: String, outputs: String)
Sets the variables in the script to only those passed into this function.
show public show()
Show the GUI form associated with the component, if any.

Connect with Ansys