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

Read Only Process Book Options · View
ThePIman
#1 Posted : Wednesday, October 06, 2010 9:56:31 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2009
Posts: 35
Location: UK
Apart from changing the file to read only or storing the file in a read only network folder, is there any way to secure a Process Book via code to stop end users tampering?
I don't want to disable menus etc, just stop them from saving changes.

Powerpoint has .pps, Excel and Word have built in password security options, but what is possible with Process Books?

.
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.
RJK Solutions
#2 Posted : Wednesday, October 06, 2010 11:14:41 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Apart from using PI-ActiveView or PI-WebParts with the Graphic web part, you can achieve this in VBA.

Providing your VBA is protected from users viewing it (thus changing it) you can use:

Code:

Private Sub Display_BeforeSave(ByVal bSaveAsUi As Boolean, bCancel As Boolean)

bCancel = True
Call MsgBox("Please note this display is protected and cannot be saved.", vbCritical)

End Sub


If you try to "Save" or "Save As" it won't let them save it.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
ThePIman
#3 Posted : Wednesday, October 06, 2010 12:01:53 PM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2009
Posts: 35
Location: UK
A lot of people are using Process Book as a viewer and not the design tool it was intended to be. That's just the culture here so we have to adapt to it.

Have been messing with that code, but can only get it to lock down each individual display, not the whole book. Little mercies et al Smile

Thanks for the note about viewing VBA, will remember to add that one.

Cheers

.
OlJo
#4 Posted : Wednesday, December 01, 2010 1:52:22 PM
Rank: Newbie
Groups: Member

Joined: 12/1/2010
Posts: 2
Location: France
Hi,

I tried to implement the code preventing user from saving the display. Once the VBA code is added I cannot save display (until here it's logical).
Now the problem is how do I save my modification in the VBA Editor ... Think

it may be a stupid question but I cannot find any solution by myself ...

Thanks in advance.

Oliver.
Tommy
#5 Posted : Friday, December 03, 2010 6:01:32 PM
Rank: Member
Groups: Member

Joined: 7/19/2010
Posts: 20
You could put the part of a code that prohibits saving into an If statement and have a password to save. For example, when someone hits "save" put a prompt up that says "enter password to save." Then their answer matches the string in the VBA code, do nothing, if not, run the two lines of code RJK provided.

And don't forget to password protect the VB code as well!
Disclaimer: Any code presented by myself might be unconventional because of the lack of formal training. Any corrections are welcome. =)
jc113883
#6 Posted : Tuesday, December 14, 2010 1:11:27 AM
Rank: Member
Groups: Member

Joined: 10/7/2009
Posts: 14
You put a break point at the start of the sub (right click > toggle > Break point) at this line:
Code:
Private Sub Display_BeforeSave(ByVal bSaveAsUi As Boolean, bCancel As Boolean)


Then you click save.

When the code window comes up, you right click on the 'end sub' line and select 'Set Next Statement'

Then press F5 and it's saved!
mric
#7 Posted : Saturday, January 07, 2012 9:04:51 PM
Rank: Newbie
Groups: Member

Joined: 11/3/2011
Posts: 7
Location: México
Hi Everyone:

Try this:
Private Sub Display_BeforeSave(ByVal bSaveAsUi As Boolean, bCancel As Boolean)
Dim yo, MyPos
yo = ThisDisplay.Users.Contents
MyPos = InStr(1, yo, "User") ' User means who can save it.
If MyPos > 0 Then
Else
bCancel = True
'Call MsgBox("Please note this display is protected and cannot be saved.", vbCritical) ' Put this if you need it or want it.
End If
End Sub
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.