测试环境:ifix4.0ifix脚本,启动按钮(CommandButton1)ifix脚本,启动对应的变量unity_start(DO)
1、编写脚本,脉冲时间由PauseTime设定
Private Sub CommandButton1_Click()
Dim PauseTime, Start
CloseDigitalPoint "UNITY_START"
PauseTime = 5 ' 设置暂停时间。
Start = Timer ' 设置开始暂停的时刻。
Do While Timer < Start + PauseTime
DoEvents ' 将控制让给其他程序。
Loop
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)
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"
End Sub
3、当前画面中按钮按下变量置1,切换画面时自动将变量置0
---------------------------------------------------
Private Sub CommandButton1_Click()
writevalue "1", "UNITY_START"
End Sub
---------------------------------------------------
Private Sub CommandButton3_Click()
writevalue "0", "UNITY_START"
openpicture "main.grf" ' 打开其他画面closepicture "myproject.grf" ' 关闭当前画面End Sub