Class ScriptInterface

Version added: before 9.5
The ScriptInterface class is a script's way of interacting with the Moho application itself. When a script is invoked (by a mouse click, a key press, or a menu command), it is provided with an object called "moho" - this object is an instance of the ScriptInterface class.

Methods of ScriptInterface:

Name Returns Description Ver
AddPointKeyframe void Adds a point motion keyframe to all the currently selected vector points < 9.5
AlignLayers void Added in version 11.1 11.1
AppDir char Returns the path to Moho's application data < 9.5
AppVersion char Added in version 9.5 - Gets the AS version number as a text string 9.5
BeginFileListing void < 9.5
BindingKeyName char Added in version 11 11
ChannelAsAnimBool AnimBool Added in version 12 12
ChannelAsAnimColor AnimColor Added in version 12 12
ChannelAsAnimString AnimString Added in version 12 12
ChannelAsAnimVal AnimVal Added in version 12 12
ChannelAsAnimVec2 AnimVec2 Added in version 12 12
ChannelAsAnimVec3 AnimVec3 Added in version 12 12
CheckIfLocked bool < 9.5
Click void Play a little clicking sound < 9.5
ClipboardText char Added in version 9.5 9.5
Copy void Basically the same as pressing Ctrl+C < 9.5
CopyAlternate void < 9.5
CopyColor void Added in version 9.5 9.5
CopyText void Added in version 9.5 9.5
CountAudioLayers int32 < 9.5
CountBones int32 Returns the number of bones in the current bone layer < 9.5
CountCurves int32 Returns the number of curves in the current vector layer < 9.5
CountEdges int32 Returns the number of edges in the current vector layer < 9.5
CountFilledShapes int32 Added in version 12 12
CountPoints int32 Returns the number of points in the current vector layer < 9.5
CountSelectedBones int32 Returns the number of selected bones in the current bone layer < 9.5
CountSelectedCurves int32 < 9.5
CountSelectedEdges int32 Returns the number of selected edges in the current vector layer < 9.5
CountSelectedFilledShapes int32 Added in version 12 12
CountSelectedPoints int32 Returns the number of selected points in the current vector layer < 9.5
CountSelectedShapes int32 Returns the number of selected shapes in the current vector layer < 9.5
CountShapes int32 Returns the number of shapes in the current vector layer < 9.5
CreateNewLayer MohoLayer Creates a new layer, inserts it directly above the currently selected layer in the Layers window, and makes it the selected layer < 9.5
CreateShape int32 Creates a shape based on the currently selected vector points < 9.5
CreateTextObject void < 9.5
CurrentEditStyle M_Style Added in version 9.5 9.5
CurrentTool char Added in version 12 12
DeleteLayer void < 9.5
DeleteMultipleLayers void Deletes selected layers < 9.5
DeselectShapes void Added in version 11 11
DestroyDocument void < 9.5
DisableDrawingTools bool < 9.5
DocToPixel real When the user specifies things like line width, blur radius, and shadow offset in Moho, they enter a value in pixels < 9.5
DrawingMesh M_Mesh Added in version 11 11
DrawShape void Added in version 10 10
DuplicateLayer MohoLayer Duplicates the given layer, placing the new copy above the old one and making it the selected layer < 9.5
EditLayerSettings void Doesn't seem to do anything. < 9.5
ExporterPath char Added in version 12 12
FileClose void Added in version 11 11
FileImport void < 9.5
FileNew void < 9.5
FileOpen void < 9.5
FileRender void Render current frame < 9.5
FileSave void < 9.5
FileSaveAs void < 9.5
FillInFontList void Fills in an LM_TextList interface object with the list of available fonts on the system < 9.5
GetAudioLayer AudioLayer < 9.5
GetNextFile char < 9.5
HasMaximumSmartBones bool Added in version 14.0 14.0
HasMaximumWarpLayers bool Added in version 14.0 14.0
ImportEPS void Import an EPS or Adobe Illustrator file into Moho, creating a new vector layer to hold it < 9.5
InsertText void Creates a new text object < 9.5
InsertText void Deprecated. Use the new InsertText method instead. < 9.5
IsCopyable bool < 9.5
IsPasteable bool < 9.5
IsPlaying bool < 9.5
IsPro bool Added in version 10 10
LayerAs3D Mesh3DLayer Converts a generic layer object into a 3D layer < 9.5
LayerAsAudio AudioLayer < 9.5
LayerAsBone BoneLayer < 9.5
LayerAsGroup GroupLayer Converts a generic layer object into a group layer < 9.5
LayerAsImage ImageLayer Converts a generic layer object into an image layer < 9.5
LayerAsNote NoteLayer < 9.5
LayerAsParticle ParticleLayer Converts a generic layer object into a particle layer < 9.5
LayerAsSwitch SwitchLayer Converts a generic layer object into a switch layer < 9.5
LayerAsVector MeshLayer < 9.5
LayersWindowGetSearchContext LayersWindowSearchContext Added in version 12.2 12.2
LayersWindowGetSearchContextValue char Added in version 12.2 12.2
LayersWindowSetSearchContext void Added in version 12.2 12.2
LayersWindowSetSearchContextValue void Added in version 12.2 12.2
LoadDocument MohoDoc < 9.5
Mesh M_Mesh Returns the 2D mesh associated with the currently active layer < 9.5
Mesh3D M_Mesh3D Returns the 3D mesh object associated with the current layer < 9.5
NewKeyframe void Tells the timeline window to display a new keyframe in the specified animation channel < 9.5
NewShapeFillColor rgb_color Added in version 9.5 9.5
NewShapeLineColor rgb_color Added in version 9.5 9.5
NewShapeLineWidth real Returns what the line width would be for a new shape < 9.5
NewShapeProperties M_Shape < 9.5
NoiseVector Vector3 Generates a semi-random vector < 9.5
OpenPoserPalette void < 9.5
ParentSkeleton M_Skeleton Returns the skeleton object associated with the parent layer of the current layer < 9.5
Paste void Basically the same as pressing Ctrl+V < 9.5
PasteAlternate void < 9.5
PickStyleProperties void < 9.5
PixelToDoc real When the user specifies things like line width, blur radius, and shadow offset in Moho, they enter a value in pixels < 9.5
PlaceLayerBehindAnother void Moves one layer behind (or below) another in the layer ordering < 9.5
PlaceLayerInGroup void Moves a layer into a group < 9.5
PurgeTracingImage void Added in version 11 11
PushStyleProperties void < 9.5
Quit void < 9.5
RestoreTracingImage bool Added in version 11 11
SaveTracingImage void Added in version 11 11
SelectedShape M_Shape Returns the first selected shape, but starting in version 10 there may be multiple selected shapes. (This method added in version 10) 10
SetCurFrame void Set the current time < 9.5
SetNewShapeLineWidth void Added in version 11 11
SetSelLayer void Changes which layer is selected in the Layers window < 9.5
ShowLayerInLayersPalette void < 9.5
Skeleton M_Skeleton Returns the skeleton object associated with the current layer < 9.5
SnapToGrid void Takes a vector position and "snaps" it to the nearest grid intersection < 9.5
TraceWhitePixels int32 Added in version 10 10
UpdateBonePointSelection void Selects the points that are bound to the currently selected bone < 9.5
UpdateSelectedChannels void Updates the display of "selected" channels in the timeline < 9.5
UpdateUI void Force the user interface to redraw itself < 9.5
UserAppDir char < 9.5
UserContentDir char 13.5.2
UserPrefsDir char 13.5.2
UserPrefsFile char 13.5.2

Properties of ScriptInterface:

Name Type Description Ver
document MohoDoc The current document object open in Moho < 9.5
drawingFrame int32 Added in version 11 11
drawingLayer MohoLayer Added in version 11. This is the vector layer where drawn paths / shapes will be placed and, especially when using frame-by-frame, is not necessarily the layer that is shown as active in the Layers window 11
drawingLayerFrame int32 Added in version 11 11
frame int32 The current frame in the timeline < 9.5
gridOn bool True if the grid is turned on in the editing view, otherwise false < 9.5
gridSize real The size of one grid unit < 9.5
layer MohoLayer The currently selected layer in the Layers window < 9.5
layerFrame int32 the frame relative to the start of the layer (if the layer has not been moved in the sequencer this will be the same as the timeline frame) < 9.5
view MohoView The editing view < 9.5