Manage Learn to apply best practices and optimize your operations.

Generate Pilotdoc Files In Notes

Generate Pilotdoc Files In Notes

PilotDOC is a file format used on Palm devices to display large text files.

This class allows you to generate & install PilotDOC files directly from Notes.

Tested: Win95, Notes R4.5, PalmOS 3.3


PalmDocName (Read/Write) String


New (PalmDocName as String)
AppendText (Text as String)
AddNewLine (Count as Integer)
Save (Path as String, AutoInstall as [True/False])
Install (Path as String [Optional], AutoRemove as [True/False][Default if path
not specified])


Sub Click(Source As Button)
Dim sess As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim pd As New PilotDOC("Budget Meeting")

Set uidoc = ws.CurrentDocument
Call pd.AppendText(uidoc.FieldGetText("PilotText"))
Call pd.Save("c:\test.pdb",False)
End If
End Sub
'PilotDOC Class 1.0
'Developed by Daniel Alvers (

Const constRECSIZE = 4096
Const constCREATOR = "TEXt"
Const constTYPE = "REAd"
Const constTIME = "?D??D?"


Public Const HKEY_CURRENT_USER = &H80000001
Public Const KEY_QUERY_VALUE = &H1

'Registry Functions
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (Byval
hKey As Long, Byval lpSubKey As String, Byval ulOptions As Long, Byval
samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryString Lib "advapi32.dll" Alias "RegQueryValueExA"
(Byval hKey As Long, Byval lpValueName As String, Byval lpReserved As Long,
lpType As Long, Byval lpData As String, lpcbData As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" Alias "RegCloseKey" (Byval hKey
As Long) As Long

'Temp path functions
Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (Byval
nBufferLength As Long, Byval lpBuffer As String) As Long
Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (Byval
lpszPath As String, Byval lpPrefixString As String, Byval wUnique As Long,
Byval lpTempFileName As String) As Long

Class PilotDOC

Private szPalmCorePath As String
Private szPalmDocPath As String
Private szPalmDocText As String

Public PalmDocName As String

Private Sub WriteStrToPDB(wFileNum As Integer, szText As String)

Dim szChar1 As String * 1
Dim szChar2 As String * 1
Dim szOut As String * 1
Dim wOddChars As Integer
Dim dwTextLen As Long
Dim dwCharPtr As Long

dwTextLen = Len(szText)

If Not dwTextLen Mod 2 = 0 Then
wOddChars = True
szText = szText + " "
End If

dwCharPtr = 1
Do Until dwCharPtr > dwTextLen
szChar1 = Mid(szText,dwCharPtr,1)
szChar2 = Mid(szText,dwCharPtr + 1,1)
szOut = Uchr(Asc(szChar2) * &H100 + Asc(szChar1))
Put #wFileNum,,szOut
dwCharPtr = dwCharPtr + 2

If wOddChars Then Seek #wFileNum,Loc(wFileNum)

End Sub

Private Sub WriteWordToPDB (wFileNum As Integer, wValue As Integer)

Dim szLow As String

szLow = Uchr(((wValue And 65280) / &H0100) + ((wValue And &HFF) *
Put #wFileNum,,szLow

End Sub

Private Sub WriteLongToPDB (wFileNum As Integer, dwValue As Long)

Dim szHigh As String
Dim szLow As String

szHigh = Uchr(((dwValue And &HFF0000) / &H0100) + ((dwValue And
&HFF000000) / &H01000000))
szLow = Uchr(((dwValue And 65280) / &H0100) + ((dwValue And &HFF) *

Put #wFileNum,,szHigh
Put #wFileNum,,szLow

End Sub

Public Sub New(szDocName As String)
PalmDocName = szDocName
End Sub

Public Sub AppendText(szText As String)
szPalmDocText = szPalmDocText + szText
End Sub

Public Sub AddNewLine( wCount As Integer)
szPalmDocText = szPalmDocText + String(wCount,10)
End Sub

Private Sub StripChr13FromText
Do While Not Instr(Me.szPalmDocText,Chr(13)) = 0
Mid(Me.szPalmDocText,Instr(Me.szPalmDocText,Chr(13)),1) = " "
End Sub

Private Function GetCorePalmPath() As String
Dim dwKey As Long
Dim szRetVal As String * 255
Dim szResult As String
Dim lpDataType As Long
Dim lpDataLen As Long

szRetVal = Str

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...