|
Navigation: Concepts > Scripting > Script Language API Reference |
![]() ![]()
|
Having a generic framework of objects and properties organized by a meta-model, allows the scripting API to be simple and generic as well. To do most things, you need to use just a few generic API calls. For example, to get all Columns in a Table, you would simply write "Table.Children("Column")". To check any property of any type of object, you would make a call like Object.Property("Property Name"). You can use standard VB Script constructs to iterate over collections, as in the following example which iterates over all Tables and prefixes the Table with "T_".
Dim Framework
Set Framework = CreateObject("SCF.ScriptFramework")
Set Models = Framework.ActiveModels
Set Model = Models.Item(1)
Model.BeginTransaction("Batch Rename Tables")
Set Tables = Model.AsObject.Children("Table")
For Each Table In Tables
Set PropValue = Framework.CreatePropertyValue("Table", "Name")
PropValue.FromString("T_" + Table.Name)
Table.SetProperty "Name", PropValue
Next
Model.EndTransaction
API Reference
ScriptFramework
Object CreateObject(String Type, Object Owner)
Bool DeleteObject(Object Object)
Object CreatePropertyValue(String ObjType, String PropType)
Object LoadModel(String ModelPath)
SaveModel(String ModelPath, Object Model)
Initialize
Object MetaModel
Object CreateObjectById(Long Type, Object Owner)
Object CreatePropertyValueById(Long ObjType, Long PropType)
Object Model(String ModelId)
ModelCollection ActiveModels
Object CreateModel
String Evaluate(String Property)
Object CurrentModel
Object CurrentSelection
Object CurrentDrawableSelection
ScriptContext
ScriptDocument ScriptDocument
Object Object
Object Options
ScriptDocument
Write(String Val)
Object
String Name
Object Property(String Type)
Collection Children(String Type)
String CreateStatement
Bool HasProperty(String PropType)
String AlterStatement
Object Owner
Long Id
Long Type
String TypeName
Bool IsValid
Bool SetProperty(String Type, Object Prop)
Bool DeleteProperty(String Type)
String DropStatement
Collection Properties
Property PropertyById(Long PropType)
Collection ChildrenById(Long ObjType)
Bool SetPropertyById(Long Type, Object Prop)
Bool DeletePropertyById(Long PropType)
Bool HasPropertyById(Long PropType)
Model Model
Collection AllChildren
String Evaluate(String Property)
Bool Equals(Object Obj)
Collection ModifiedProperties
Collection ModifiedChildrenPosition
Property OriginalProperty(String Type)
Collection OriginalChildren(String Type)
Bool HasLocalProperty(String PropType)
Bool HasLocalPropertyById(Long PropType)
Object OldOwner
ObjectCollection
Object Item(Long Index)
Long Count
Property
Long Type
String Name
Object Value
PropertyCollection
Property Item(Long Index)
Long Count
PropertyValue
String AsString
Bool AsBoolean
Long AsInteger
Double AsDouble
Object AsObject
Collection AsVector
Bool IsStringProperty
Bool IsBooleanProperty
Bool IsIntegerProperty
Bool IsDoubleProperty
Bool IsObjectProperty
Bool IsVectorProperty
Bool IsNull
FromString(String Val)
FromBoolean(Bool Val)
FromInteger(Long Val)
FromDouble(Double Val)
FromObject(Object Val)
VectorPropertyValue
Object Item(Long Index)
Long Count
AddValue(Object Val)
ChildOrderItem
Object Child
Long NewPosition
Long OldPosition
ChildOrderItemCollection
Object Item(Long Index)
Long Count
Model
String Name
Object AsObject
Object MetaModel
String Id
BeginTransaction(String pVal)
EndTransaction
RollbackTransaction
Undo
Redo
ModelCollection
Model Item(Long Index)
Long Count
MetaModel
Collection MetaObjects
MetaObject MetaObjectById(Long type)
MetaObject MetaObject(String Type)
MetaObject
Long Type
String Name
Collection MetaObjects
Collection MetaProperties
MetaObject MetaObjectById(Long type)
MetaObject MetaObject(String Type)
MetaProperty MetaPropertyById(Long type)
MetaProperty MetaProperty(String Type)
MetaObjectCollection
MetaObject Item(Long Index)
Long Count
MetaProperty
Long Type
String Name
MetaPropertyCollection
MetaProperty Item(Long Index)
Long Count
Page url: http://www.modelright.com