恭喜,你发布的帖子
发布于 2022-07-02 14:08:33
3楼
您好
C脚本确实有点难度,上手需要一定的编程基础,需要有一定的C语言基础。
或者您也可以参考VBS脚本的批处理读写变量,相对比较简单些。
以下是读两个变量的值,用Add方法可以添加变量,Write方法一次性执行写操作。
=======================================
Build a Reference to the TagSet Object
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
'Add Tags to the Collection
group.Add "Motor1"
group.Add "Motor2"
'Set the Values of the Tags
group("Motor1").Value = 3
group("Motor2").Value = 9
'Write the Values to the DataManager
group.Write
========================================
以下是读两个变量的值,用Add方法可以添加变量,Read方法一次性执行读操作。
group("Motor1").Value
group("Motor1").Value
以上2句语句是获取变量值,你可以任意赋值给其它对象
======================================
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
group.Read
HMIRuntime.Trace "Motor1: " & group("Motor1").Value & vbNewLine
HMIRuntime.Trace "Motor2: " & group("Motor2").Value & vbNewLine
请填写推广理由:
分享
只看
楼主