I have a Macro in PI Processbook. It runs when Processbook is opened.
Is it possible to have this macro run every 5 minutes?
I haven't tested this but could you use the method described here: excel - How to have vba execute every 10 minutes? - Stack Overflow? In your Display Open sub just make a call to "my_Procedure"
I have read somewhere on this forum that PI Processbook doesn't support TimeValue.
Hmm it seems you are right. I had that function call in one of my source files but it doesn't appear to be working. I'll do some experimenting this afternoon and see if I can come up with a workaround
The easiest solution is to use the Display_DataUpdate which is called every 5 seconds by default. The code would look something like this:
Dim time As Integer
Private Sub Display_DataUpdate()
time = time + 5
If time >= 300 Then
time = 0
If you want greater control over your timer, you may want to look want to look at this post from a couple years ago:
How to use a timer in VBA ProcessBook? (i.e. Animation or recurring update ... )
This is an awesome solution, however, I waited over 5 minutes. I do not see it calling the Sub CheckThingOnTimer().
The first thing I do is add a breakpoint in the Display_DataUpdate() function and make sure it's getting called. If it does get hit, I would make sure that the time variable is increasing with every pass.
If it doesn't get hit, I would check the procbook.ini Data Manager Timer attribute value to ensure that it is supposed to be called every 5000ms.
I confirmed by putting a msgbox() code. The Data Update is running every 5 seconds. I am not sure why code below is not working anymore? It was working and saving an image yesterday.
Call ThisDisplay.SaveAs("ongoing" & i, pbpdFormatJPEG)
If you mean that you are expecting a new file to be written each time, then that won't happen as your variable i is not changing. It will keep overwriting the old file so you can check that the last modified time has changed.
Retrieving data ...