powerdesigner 执行脚本 将 comment 写入 name
参考网上答案: 只能用于 物理模型
1 Option Explicit 2 ValidationMode = True 3 InteractiveMode = im_Batch 4 5 Dim mdl 6 7 Set mdl = ActiveModel 8 If (mdl Is Nothing) Then 9 MsgBox "There is no current Model" 10 ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then 11 MsgBox "The current model is not an Physical Data model." 12 Else 13 ProcessFolder mdl 14 End If 15 16 Private sub ProcessFolder(folder) 17 Dim Tab 18 for each Tab in folder.tables 19 if not tab.isShortcut then 20 if (not isnull(tab.comment)) and (trim(tab.comment)<>"") then 21 tab.name = tab.comment 22 end if 23 Dim col 24 for each col in tab.columns 25 if (not isnull(col.comment)) and (trim(col.comment)<>"") then 26 col.name= col.comment 27 end if 28 next 29 end if 30 next 31 32 Dim view 33 for each view in folder.Views 34 if not view.isShortcut then 35 if (not isnull(view.comment)) and (trim(view.comment)<>"") then 36 view.name = view.comment 37 end if 38 end if 39 next 40 41 end sub