In Vision, I want to record/assign to a tag the date a button is pushed

I have to admit I’m a little lost on how to record the date n time that an operator presses a button.
I want to grab the start dat/time for the beginning of chart X axis and the grab a second button bush to grab the end moment for a particular chart.

Is using auditing not an option?

https://docs.inductiveautomation.com/display/DOC81/Auditing+Actions+Reference

Forgive me if i’ve missed the question, but if you simply want to write the time of a button click to a tag, this should do it.

1 Like

Probably should be in the actionPerformed event, not the mouseClicked event....

2 Likes

I typically use the mouse released event since that allows one to opt out of clicking the button if it was a mistake, though i don’t pretend to fully grasp the use of the actionPerformed event. does it just also trigger with a key press?

actionperformed takes the enabled state into account

4 Likes

Thanks everyone. Got her running. I originally tried to script it thinking I could just take date.now() and and write to my Start and End dates with and “=” like you can with in an INT, Real, other common data types. Once I used system.tag.writeBlocking(paths, values) … life was good.