Script Object

Derived from: Base Object
Defined in namespace "adsk::core" and the header file is <Core/Application/Script.h>

Description

Object that represents a script or add-in.

Methods

Name Description
classType Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType().
edit Invokes the default edit behavior for this script or add-in.
run Runs this script or add-in, if it's not already running.
stop If this script or add-in is running, this method will stop it. The isRunning property can be used to determine if it is running. If the script or add-in is not running and this method is called, there is no effect.

Properties

Name Description
author Returns the author information associated with this script or add-in.
description Gets the description of this script or add-in.
folder Gets the full path of the folder that contains this script or add-in.
id Gets the ID of this script or add-in. This is typically a GUID and is assumed to be unique with respect to all other add-ins.
isAddIn Gets if this Script object represents a script or an add-in. Returns true if it is an add-in.
isEditable Indicates if this script or add-in is blocked from being edited by the user in the "Scripts and Add-Ins" dialog.
isInternal Indicates if this is an internal script or add-in that is delivered with Fusion. Returns true if it is an internal script or add-in.
isRunning Gets if this script or add-in is currently running.
isRunOnStartup Gets and sets whether this add-in will automatically run when Fusion is started. This property is only valid when the isAddIn property returns true.
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
isVisible Gets and sets whether the script or add-in is visible within the “Scripts and Add-Ins” dialog. By default, all scripts and add-ins are visible. Setting this to false will cause it to be hidden and unloaded if it is already running. Also, if it’s an add-in set to load on startup, it will no longer be loaded.
manifestContent Gets the full contents of the manifest file associated with this script or add-in. This is particularly useful if you have any custom information defined in the manifest. The manifest file uses JSON to format its content.
name Gets the name of this script or add-in.
objectType This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.

It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType():
programmingLanguage Returns the programming language this script or add-in is written in.
targetOperatingSystem Returns the operating systems this script or add-in is available for.
version Returns the version information associated with this script or add-in.

Accessed From

Scripts.addExisting, Scripts.addNew, Scripts.item

Version

Introduced in version October 2023