YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Clock Control in ProcessBook Options · View
sutasu
#1 Posted : Monday, July 26, 2010 9:06:49 PM
Rank: Member
Groups: Member

Joined: 6/11/2010
Posts: 11
Location: Russia, Moscow
I need to place a clock on a ProcessBook screen(and then on ActiveView web page), but I cannot find it among the standard controls. What OCX can I use or can I hook to some event to get a text field with time updated every second?
Thanks.
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
Tommy
#2 Posted : Tuesday, July 27, 2010 12:01:43 AM
Rank: Member
Groups: Member

Joined: 7/19/2010
Posts: 20
I have not used the ActiveView module, but for ProcessBook with VBA you can get the local machine clock with:
Code:
MsgBox DateTime.Time

Or to get the PI Server time:
Code:
Sub clock()
'Replace ServerName with your own server name in quotes
mySRV = PISDK.Servers("ServerName")
If Not PISDK.Servers("ServerName").Connected Then PISDK.Servers("ServerName").Open
MsgBox PISDK.Servers("ServerName").ServerTime.LocalDate   'formatted date
MsgBox PISDK.Servers("ServerName").ServerTime.UTCSeconds  'number of seconds
End Sub

Private Sub Display_DataUpdate()
Call clock()
EndSub

The clock() routine will give two messages - one with the date and time in a readable format, the second as a number of seconds. Either of these can be put into a Value object in PB.
The second routine is the built-in function that runs each time the display calls for new values (default is 4 seconds I believe). To get the time to refresh each second (along with the actual values) change the refresh rate to 1 second.
One final note - to use the PISDK commands, add a reference to pisdk.dll (in the VBA window, go to Tools -> References and check PISDK 1.3 Type Library).
Disclaimer: Any code presented by myself might be unconventional because of the lack of formal training. Any corrections are welcome. =)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.