為什么編譯通過,但執(zhí)行不了
林慧玲
發(fā)布于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