
MAIL
Informing the users of their mail size and quotas via the standard MailFS frameset
Steven Gatehouse 04.23.2001
Rating: -4.06- (out of 5) Hall of fame tip of the month winner




|
You Can View User Feedback To This Tip
Upgrading to R5 mail quotas have started to be used more and more. I wanted a way to tell how much space I had left in my mail file so that I would not receive that horrid, "...would exceed it on disk quota..." message. The solution I came up with was a small piece of LotusScript that checks the mail file size and displays a "status bar" graphic. It includes the size of file along with a percentage reading and current size. By placing this information in the top left frame of the mail file frameset, users can see when their database is getting too close to its maximum file size.
The solution involves three steps:
1. Create a new form with four fields
2. Add the LotusScript to the PostOpen event of the form
3. Modify the MailFS Frameset to include the form
Code
Code:
1) First, create a form and create four "Computed For Display" fields as follows:
SaveOptions with a value of "0"
DisplayBar with value DisplayBar (make it native OS style with a size of 0.700")
MailDisplay with value MailDisplay
FileSize with value FileSize
Make all the fields of type text, font Default Sans Serif size 8 and plain (apart from DisplayBar which should be bold)
Place the SaveOptions field at the top of your form
Then add a fixed width 1x2 table (Column One fixed at 0.75", Column Two fixed at 1.25") and place the DisplayBar field in column One and MailDisplay and FileSize in column two but on separate lines.
2)
Once you have added the fields, add the following script to the PostOpen event of your new form then save and close the form.
'Script begins
Sub Postopen(Source As Notesuidocument)
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Set db = session.currentdatabase
Set doc = source.document
dbsize = (db.size)/1000
dbmax = db.sizequota
percent = (dbsize/dbmax)
For i = 0 To (percent*100)
bars = bars & "|"
' Each bar represents 5%
i = i + 5
Next
message = "Database at " & Cint(percent*100) & "%"
doc.FileSize = Format((dbsize/1000) , "Fixed") & "Mb"
doc.MailDisplay = message
doc.DisplayBar = bars
End Sub
'Script ends
3)
Now all that remains is to update the frameset design so that the top left frame does not to include the "Mail Title" page but your new form.
USER FEEDBACK TO THIS TIP
- I liked the example of the Frameset notice of the quota but it has a minor bug -- the FOR LOOP includes "i = i + 5" but does not take into
consideration that the FOR also increments the counter. Thus, the counter is being incrementing by six rather than five. I also adapted it to my own preferences with a few twists.
Dim session As New notessession
Dim db As notesdatabase
Set db = session.currentdatabase
Const MB_OK = 0 ' OK button only
Const MB_IconInformation = 64 ' Information message
dbsize = (db.size)/1000
dbmax = db.sizequota
percent% = Cint( dbsize/dbmax*100 )
Bars$ = " |"
For i = 0 To 100
If i <= Percent% Then
bars$ = bars$ & "="
Else
bars$ = bars$ & " -"
End If
i = i + 4 ' Each bar represents 5%
Next
bars$ = bars$ & "| "
Print "Mail database at " & Percent% & "% of quota" & Bars$ & _
"Size: " & Format((dbsize/1024) , "Fixed") & "Mb Max: " & Format
((DBMax/1024) , "Fixed") & "Mb"
If Percent% > 90 Then ' provide a stronger warning at 90%
Msgbox "Mail database at " & Percent% & "% of quota" & Chr(10) &
Chr(10) & _
Bars$ & Chr(10) & Chr(10) & _
"Size: " & Format((dbsize/1024) , "Fixed") & "Mb Max: " &
Format((DBMax/1024) , "Fixed") & "Mb", _
MB_IconInformation + MB_OK, "Warning: Mailbox approaching maximum
size"
End If
Doug Jamieson
 |

|
|
 |
|
 |