立即登录

ifix脚本 :+PauseTimeDoEvents

09/15 05:21:19

测试环境:ifix4.0ifix脚本,启动按钮(CommandButton1)ifix脚本,启动对应的变量unity_start(DO)

1、编写脚本,脉冲时间由PauseTime设定

Private Sub CommandButton1_Click()

Dim PauseTime, Start

CloseDigitalPoint "UNITY_START"

PauseTime = 5 ' 设置暂停时间。

ifix脚本_ifix官网_ifix opc

Start = Timer ' 设置开始暂停的时刻。

Do While Timer < Start + PauseTime

DoEvents ' 将控制让给其他程序。

Loop

ifix官网_ifix脚本_ifix opc

OpenDigitalPoint "UNITY_START"

End Sub

2、编写脚本,鼠标按下变量置1,鼠标弹起变量置0

Private Sub CommandButton1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

ifix opc_ifix官网_ifix脚本

writevalue "1", "UNITY_START"

End Sub

Private Sub CommandButton1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

writevalue "0", "UNITY_START"

ifix脚本_ifix官网_ifix opc

End Sub

3、当前画面中按钮按下变量置1,切换画面时自动将变量置0

---------------------------------------------------

Private Sub CommandButton1_Click()

ifix官网_ifix opc_ifix脚本

writevalue "1", "UNITY_START"

End Sub

---------------------------------------------------

Private Sub CommandButton3_Click()

writevalue "0", "UNITY_START"

openpicture "main.grf" ' 打开其他画面closepicture "myproject.grf" ' 关闭当前画面End Sub

最新资讯