powerdesign中运行脚本

来源:互联网 发布:拆分盘股权源码 编辑:程序博客网 时间:2024/05/03 14:26

 Option Explicit

'-----------------------------------------------------------------------------

' 魔尊年少时制作 http://pc-funning.cnblogs.com/

' 随便修改增强,希望能做记录,做注释,保留出处

' 2009-11-2最后整理

'-----------------------------------------------------------------------------

Dim system, file

Set system = CreateObject("Scripting.FileSystemObject") '创建文件对象

Dim ForReading, ForWriting, ForAppending

dim str

dim tittle

dim first

ForReading   = 1 ' 设置文件只读

ForWriting   = 2 ' 设置文件写入

ForAppending = 8 ' 设置文件追加

'-----------------------------------------------------------------------------

' 主要程序

'-----------------------------------------------------------------------------

Set file = system.OpenTextFile("D:/table.txt", ForReading)'打开文本文档

Dim noLine

Dim Tab  '定义一个表,vbscript中变量没有那么严格的类型,但此变量将来将用来表示table

ValidationMode = True

Dim mdl ' 定义当前激活的模型,也就是mdl


dim dm, dmstr

Dim SSS

Dim newTable
Dim oldTable
Dim col
Set mdl = ActiveModel '获取当前激活模型
msgbox mdl
first = file.readline
on error goto 0
  Do While file.AtEndOfStream <> True '循环读取文档的每一行
       tittle = split(first)
       oldTable = tittle(3)
       str=tittle
       for each Tab in mdl.tables
         MsgBox  Tab.isshortcut
          newTable = Tab.code
        
          if(newTable = oldTable) then
                   msgbox newTable
                       for each col in Tab.columns
                            if col.code = str(1) then
                                        col.name = str(0)
                                     
                    
                              end if
                              if file.AtEndOfStream<>True then
                             
                                    first = file.readline
                                    on error goto 0
                                    str = split(first)
                                   end if
             
                       next
               
          end if
      
       next
 
  Loop

 

 

 

 


file.Close

 

原创粉丝点击