inductiveautomation.com/forum/v … 50&t=15912
Regarding the topic above which is now locked (probably because I prematurely marked it as solved?) it seems that my script runs successfully only once and never again, unless I edit the tag change script. I can edit it in any way and then it works again…once and only once.
My logic is (was) nearly identical to the suggestion except that I made my expression tag equal to Hour x 100 + Minute. So 2359 is 11:59 pm. And I am looking to run the script at 11:59 pm, so instead of:
if not initialChange and newValue.value==0:
project.myScript.myFunction()
I had:
if not initialChange and newValue.value==HourRPT:
project.MakeRPT
Where in my project HourRPT is a memory tag containing the value at which time I want to trigger the call. This lets me try things out without messing with the PC clock or waiting until a minute til midnight to test it.
I have tried replacing newValue.value with currentValue, currentValue.value, and several other modifications in an attempt to solve this but the same problem remains. It works after I make any change and never again…
My last attempt replaced my memory tag with >= a constant 2355 (since I was up til almost midnight messing with it) and I did away with the not Initialchage part. So it should have run the tag change script once every minute and should have passed the “if” test five times at 2355, 2356, 2357, 2358, and 2359, but it didn’t. It ran once at 2355…
I can call my MakeRPT script with a button or from the script console and it works (it creates a text file with some tag data in certain physical locations). So somehow the logic I am using is only deemed true once.
When I monitor the Gateway script in the browser, it appears that it does indeed run every minute on the dot. I am stumped trying to figure out why the if test seems to only go true once.
Here’s what I have right now (but the behavior is identical to all the other attempts I have made):
if currentValue >= 2355:
project.MakeReportRP
And, my tag named “Hour” does show the correctly calculated value and changes each minute like I’d expect.
Any ideas?