实验成功的WINCC读取TXT文件代码--VBS

时间:2026-01-16

Dim fso

Dim txtfile

Dim a

'a=HMIRuntime.Tags("FileName").Read

Set fso = CreateObject("scripting.filesystemobject")

If fso.FileExists("E:\test\Export\UserArchiveControl\12345678FAIL.txt") Then

'MsgBox "文件存在"

'If fso.FileExists("D:\\Export&Import\\"&CStr(a)&".txt") Then

Set txtfile = fso.OpenTextFile("E:\test\Export\UserArchiveControl\12345678FAIL.txt")

MsgBox "开始读取" HMIRuntime.Tags("Var_1").Write txtfile.ReadLine HMIRuntime.Tags("Var_2").Write txtfile.ReadLine HMIRuntime.Tags("Var_3").Write txtfile.ReadLine HMIRuntime.Tags("Var_4").Write txtfile.ReadLine HMIRuntime.Tags("Var_5").Write txtfile.ReadLine HMIRuntime.Tags("Var_6").Write txtfile.ReadLine HMIRuntime.Tags("Var_7").Write txtfile.ReadLine HMIRuntime.Tags("Var_8").Write txtfile.ReadLine HMIRuntime.Tags("Var_9").Write txtfile.ReadLine HMIRuntime.Tags("Var_10").Write txtfile.ReadLine HMIRuntime.Tags("Var_11").Write txtfile.ReadLine HMIRuntime.Tags("Var_12").Write txtfile.ReadLine HMIRuntime.Tags("Var_13").Write txtfile.ReadLine HMIRuntime.Tags("Var_14").Write txtfile.ReadLine HMIRuntime.Tags("Var_15").Write txtfile.ReadLine HMIRuntime.Tags("Var_16").Write txtfile.ReadLine HMIRuntime.Tags("Var_17").Write txtfile.ReadLine HMIRuntime.Tags("Var_18").Write txtfile.ReadLine HMIRuntime.Tags("Var_19").Write txtfile.ReadLine HMIRuntime.Tags("Var_20").Write txtfile.ReadLine MsgBox "导入数据成功/Import Successful" txtfile.Close Else MsgBox "文件不存在/File is not existing" End If

实验成功的WINCC读取TXT文件代码--VBS.doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:4.9 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:19元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219