Script on momentory button

this is my script on my momentary button


it does high (i.e =1) my tag when i pressed my button but CANNOT put low (i.e =0) when i release button. as it is a momentary button it should be like " high on press and low on released" like positive pulse

Don’t use a script. The momentary button drives it’s .controlValue property, which you are expected to bidirectionally bind to the tag you want to control. In your case, with an indirect binding incorporating that tagpath property.

But beware, there are gotchas with momentary buttons in general, where you can lose the “off” operation. You generally need PLC code of some kind to mitigate this. See this topic and the linked topics within:

1 Like