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

Properties

PalmDocName (Read/Write) String

Methods

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])

Example

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 (daniel.alvers@au.pwcglobal.com


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

Const constINSTAPP = "INSTAPP.EXE"

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

'Globals
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
Loop

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) *
&H0100))
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) *
&H0100))

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) = " "
Loop
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
This was first published in November 2000

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close