< Back
Document Subject: Counter Agent that displays Number as a graphic
Hint Short Cut:
Add this to your code & documentation to help you find this page.
http://#GraphicAgent
or
http://A555F9/nn.nsf/ByAlias/GraphicAgent
This code displays the number of hits as a graphic on the page.
Dim session As New NotesSession
Dim db As NotesDatabase
Set db=session.CurrentDatabase
Set doc=session.DocumentContext
Dim Account As NotesDocument
Dim Accounts As NotesView
Dim digits(9) As String
digits(0) = "3c 66 66 66 66 99 66 66 66 3c"
digits(1) = "f8 04 02 01 01 01 80 40 20"
digits(2) = "3c 66 60 60 30 18 0c 06 06 7e"
digits(3) = "3c 66 60 60 38 60 60 60 66 3c"
digits(4) = "30 30 38 38 34 34 32 7e 30 78"
digits(5) = "7e 06 06 06 3e 60 60 60 66 3c"
digits(6) = "38 0c 06 06 3e 66 66 66 66 3c"
digits(7) = "7e 66 60 60 30 30 18 18 0c 0c"
digits(8) = "3c 66 66 66 3c 66 66 66 66 3c"
digits(9) = "3c 66 66 66 66 7c 60 60 30 1c"
' You must create view Accounts with first column with value HTTP_Referer and Ascending sorting
' Set Accounts=db.GetView("Accounts")
' Set Account = Accounts.GetDocumentByKey( doc.HTTP_Referer(0) )
'
' If Account Is Nothing Then
' Set Account = New NotesDocument( db )
' Account.HTTP_Referer = doc.HTTP_Referer(0)
' Else
' count = Account.count(0)
' End If
'Account.count = count + 1
' Call Account.save(True, True)
count = Format(12345,"00000")
xlen = Len(count)
bytes = ""
For i = 0 To xlen-1
bytes = bytes + "0xff,"
Next
For i = 0 To xlen*2-1
bytes = bytes + "0x00,"
Next
For y=0 To 9
For x=0 To xlen-1
digit = Mid(count,x+1,1)
byte = Mid(digits(digit),1+y*3,2)
bytes = bytes + "0x" + byte + ","
Next
Next
For i = 0 To xlen*3-1
bytes = bytes + "0x00,"
Next
Print "Content-type: image/x-xbitmap\n\n"
Print "#define count_width "+xlen*8
Print "#define count_height 16"
Print "static char count_bits[] = {"
Print bytes
Print "};"