powerdesigner中获取pdm中所有对象并修改的vbscript例子

powerdesigner是个好东西,设计工作中经常有些工作需要批量执行修改,采用其自带的脚本语言是个不错的选则,下面这段脚本把pdm中所有对象并修改,其中包含对多层package中对象的调用,很方便

 


Option Explicit
ValidationMode = True
InteractiveMode = im_Batch

'ceaate by runnerrunning

' get the current active model
Dim mdl ' the current model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
   MsgBox "There is no Active Model"
Else
   ListObjects(mdl)
End If


'-----------------------------------------------------------------------------
Private Sub ListObjects(fldr) '列出所有的对象
   output "Scanning " & fldr.code
   Dim obj ' running object
   For Each obj In fldr.children
      ' Calling sub procedure to print out information on the object
      DescribeObject obj
      TableSetComment obj
   Next

   ' go into the sub-packages
   Dim f ' running folder
   For Each f In fldr.Packages '递归调用列出所有的对象
      'calling sub procedure to scan children package
      ListObjects f
   Next
End Sub

'-----------------------------------------------------------------------------
' Sub procedure to print information on current object in output
'-----------------------------------------------------------------------------
Private Sub DescribeObject(CurrentObject)
   if not CurrentObject.Iskindof(cls_NamedObject) then exit sub
   output "Found "+CurrentObject.ClassName+" """+CurrentObject.Name+""", Created by "+CurrentObject.Creator+" On "+Cstr(CurrentObject.CreationDate)  
End Sub

'ceaate by runnerrunning

Private Sub TableSetComment(CurrentObject)
   if not CurrentObject.Iskindof(cls_Table) then exit sub
   'output "Found "+CurrentObject.ClassName+" """+CurrentObject.Name+""", Created by "+CurrentObject.Creator+" On "+Cstr(CurrentObject.CreationDate)  
      if not CurrentObject.isShortcut then
         CurrentObject.Comment = CurrentObject.name &vbCrLf& CurrentObject.Comment
         Dim col ' running column
         for each col in CurrentObject.columns
            col.Comment = col.name &vbCrLf& col.Comment
         next
      end if  
  
End Sub

//本人原创runnerrunning@163.com转载请保留本信息
//http://blog.csdn.net/runnerrunning
//大家看了别忘了点右边的广告阿支持一下runnerrunning@163.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值