代码4:VBS调用CST进行运算
Dim app
Set app = CreateObject("CSTStudio.Application")
Dim mws
Set mws = app.OpenFile("D:/VBS/1.cst")
'mws.Visible = False
With mws
.DeleteResults
.Rebuild
.Solver.Start
.Save
End With
mws.Quit
代码5:VBS调用CST进行运算
Dim fs
Set fs =createobject("scripting.filesystemobject")
Dim ts
Set ts=fs.opentextfile("opt.txt",1,true)
Dim path
path=ts.readall
ts.close
'msgbox path
Dim app
Set app = CreateObject("CSTStudio.Application")
Dim mws
Set mws = app.OpenFile(path)
Dim chang
Dim kuan
Dim gao
'Dim result(30)
Set ts=fs.opentextfile("chang1.txt",1,true)
chang=ts.readline
'msgbox chang
ts.close
Set ts=fs.opentextfile("kuan1.txt",1,true)
kuan=ts.readline
'msgbox kuan
ts.close
Set ts=fs.opentextfile("gao1.txt",1,true)
gao=ts.readline
'msgbox gao
ts.close
With mws
.DeleteResults
.StoreParameter "Lg", chang
.StoreParameter "Ls", kuan
.StoreParameter "Lcross", gao
.Rebuild
.Solver.Start
.Save
End With
mws.Quit
Dim app
Set app = CreateObject("CSTStudio.Application")
Dim mws
Set mws = app.OpenFile("D:/VBS/1.cst")
'mws.Visible = False
With mws
.DeleteResults
.Rebuild
.Solver.Start
.Save
End With
mws.Quit
代码5:VBS调用CST进行运算
Dim fs
Set fs =createobject("scripting.filesystemobject")
Dim ts
Set ts=fs.opentextfile("opt.txt",1,true)
Dim path
path=ts.readall
ts.close
'msgbox path
Dim app
Set app = CreateObject("CSTStudio.Application")
Dim mws
Set mws = app.OpenFile(path)
Dim chang
Dim kuan
Dim gao
'Dim result(30)
Set ts=fs.opentextfile("chang1.txt",1,true)
chang=ts.readline
'msgbox chang
ts.close
Set ts=fs.opentextfile("kuan1.txt",1,true)
kuan=ts.readline
'msgbox kuan
ts.close
Set ts=fs.opentextfile("gao1.txt",1,true)
gao=ts.readline
'msgbox gao
ts.close
With mws
.DeleteResults
.StoreParameter "Lg", chang
.StoreParameter "Ls", kuan
.StoreParameter "Lcross", gao
.Rebuild
.Solver.Start
.Save
End With
mws.Quit