'*****************************************************************************
'文件:Set color of entities shortcut.vbs
'版本:1.0
'版权:floodzhu( floodzhu@hotmail.com ),2005.1.6
'功能:遍历概念模型,把Entities的快捷方式的颜色设置为黄色。
'*****************************************************************************
' dim fs,f
' set fs = CreateObject("Scripting.FileSystemObject")
' set f = fs.CreateTextFile("C:\PowerDesigner_vbs.log")
dim index
index = 0
dim model
set model = ActiveModel
If (model Is Nothing) Then
MsgBox "当前没有活动的模型。"
ElseIf Not model.IsKindOf(PdCDM.cls_Model) Then
MsgBox "当前模型不是概念模型。"
Else
View model
MsgBox index & "个实体的快捷方式的颜色被设置。"
End If
'*****************************************************************************
'函数:View
'功能:递归遍历
'*****************************************************************************
sub View(folder)
dim node
for each node in folder.Entities
if node.IsShortCut then
Visit node
end if
next
'对子目录进行递归
dim subFolder
for each subFolder in folder.Packages
View subFolder
next
end sub
'*****************************************************************************
'函数:Visit
'功能:处理节点
'*****************************************************************************
sub Visit(node)
dim sym
for each sym in node.symbols
sym.FillColor = rgb(255, 255, 128)
index = index + 1
'f.writeline sym.name & " ● " & sym.FillColor
next
end sub