[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=2745&ptid=1247][color=#999999]我要当反贼 发表于 2023-04-10 17:01[/color][/url][/size]
请写出完整的程序[/quote]
完整的程序如下:
[code]Sub OnClick(ByVal Item)
If Item.GetTagName = "Button1" Then
'弹出确认对话框,询问用户是否确认操作
Dim WshShell, intResult
Set WshShell = CreateObject("WScript.Shell")
intResult = WshShell.Popup("是否确认此操作?", 0, "提示", vbYesNo + vbQuestion)
'根据用户的选择更新变量值
If intResult = vbYes Then
If Item.GetPropertyValue("Tag1") = 0 Then
Item.SetPropertyValue "Tag1", 1
Else
Item.SetPropertyValue "Tag1", 0
End If
End If
End If
End Sub[/code]
请将上述代码复制到WINCC VBS脚本编辑器中,并确保按钮名称为“Button1”和要控制的变量名称为“Tag1”。 |