请教一个WINCC Vbs脚本的问题。
WINCC为7.0亚洲版。
操作系统为WIN_XP_SP2英文专业版.
软件均为正版.
共有2台工控机,都是单站模式,项目文件是一模一样的。就是完全一样的两套东西。
在WINCC项目中写了一个VBs脚本,目的是,项目语言为中文时,显示中文文档;项目语言为英文时,显示英文文档。
在其中一台工控机上VBs脚本运行正常,可以正确显示文档。但是用WINCC项目复制器复制到另一台工控机上,其他所有的功能都正常,就是这个VBS脚本不正常,文档路径是空的,文档不显示。不知道是不是因为VBS脚本没有运行的问题。但是其他的C全局脚本却运行正常。
系统是新装的,除了WINCC和STEP7,PDF之外,没有安装任何其他软件。
我就郁闷了,为什么一样的东西,复制过来就不对了呢?
找了个调试程序看了下,脚本是运行了,但是出错。
错误信息如下:
Error: HMIRuntime.get_BaseScreenName: No such interface supported.
下面附上脚本代码:
Public Function SetPDFPresentation(PDFChina,PDFEnglish)
Dim ServerName
Set ServerName = HMIRuntime.Tags("@ServerName")
ServerName.Read
Dim PDFPath
PDFPath = "\\" & ServerName.Value & "\WinCC_Project_0902201hmi\drawing\"
Dim Control
Set Control = HMIRuntime.Screens(HMIRuntime.BaseScreenName).ScreenItems("win12").screen.ScreenItems("win1").screen.ScreenItems("win1").screen.ScreenItems("control1")
Select Case HMIRuntime.Language
Case 1028 ' China
Control.MyPage = PDFPath & PDFChina
Case Else
Control.MyPage = PDFPath & PDFEnglish
End Select
'HMIRuntime.Trace "Link: " & Control.MyPage & vbCrLf
Set Control = Nothing
Set ServerName = Nothing
End Function