为什么编译通过,但执行不了
林慧玲
发布于2014-04-01 17:29
17
0
标签:
dima,b
seta=hmiruntime.tags("xp")
a.read
ifa=1then
b=msgbox("是否解除连锁",vbokcancel,"m11")
ifb=1then
a.value=a.valueand&h00
endif
endif
ifa=0then
a.value=a.valueor&h01
endif
a.write
endsub
佳答案
不知道要干什么?脚本无论后结果是什么,a的值后都是非0的值,因为后一个if满足则a写入非零值,如果不满足则a就是非零值,语法正确不代表逻辑就是正确的。
dima,b
a=hmiruntime.tags("xp").read
ifa=1then
ifmsgbox("是否解除连锁",1,"m11")=vbokthen
hmiruntime.tags("xp").write0
endif
elseifmsgbox("是否启用连锁",1,"m11")=vbokthen
hmiruntime.tags("xp").write1
endif
endif