'++LotusScript Development Environment:2:5:(Options):0:74
Option Public
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Type SECURITY_ATTRIBUTES
Declare Function ReplaceStr (S As String, O As String, R As String) As String
Declare Sub Initialize
Declare Sub ParseNetscapeBookmark
Declare Sub CallDefaultBrowser
Declare Sub SetWebTrekLicenseKey
'++LotusScript Development Environment:2:5:(Declarations):0:10
Declare Public Function GetPrivateProfileString Lib"Kernel" (Byval lpName As String, Byval lpKey As Any, Byval lpDefault As String, Byval lpReturn As String, Byval nSize As Integer, Byval lpFile As String) As Integer
Declare Public Function RegOpenKeyExA Lib "advapi32" Alias "RegOpenKeyExA" (Byval HKEY As Long,Byval lpszSubKey As String,Byval dwreserved As Integer,Byval samDesired As Long, keyresult As Long) As Long
Declare Public Function RegQueryValueExA Lib "advapi32" Alias "RegQueryValueExA" (Byval HKEY As Long,Byval lpszValueName As String,Byval dwreserved As Integer, lpdwtype As Long, Byval lpData As String, readbytes As Long) As Long
Declare Public Function RegCloseKey Lib "advapi32" Alias "RegCloseKey" (Byval HKEY As Long) As Long
Declare Public Function GetPrivateProfileStringA Lib "kernel32" Alias "GetPrivateProfileStringA"(Byval AppName As String,Byval KName As Any, Byval Def As String, Byval RStr As String, Byval nSize As Integer, Byval FName As String) As Integer
Dim strURL As String
Dim strPageTitle As String
Dim iMoreInfo As Integer 'Tracks 'more info' on the Found Set Report
'Begin Global BlockTranslated from WebTrek Licensing Source Code
Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Integer
End Type
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (Byval hKey As Long, Byval lpSubKey As String, phkResult As Long) As Long
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (Byval hKey As Long, Byval lpSubKey As String, phkResult As Long) As Long
Declare Function RegQueryValue Lib "advapi32.dll" Alias "RegQueryValueA" (Byval hKey As Long, Byval lpSubKey As String, Byval lpValue As String, lpcbValue As Long) As Long
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 RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (Byval hKey As Long, Byval lpSubKey As String, Byval Reserved As Long, Byval lpClass As String, Byval dwOptions As Long, Byval samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (Byval hKey As Long, Byval lpValueName As String, Byval Reserved As Long, Byval dwType As Long, lpData As Any, Byval cbData As Long) As Long
Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (Byval hKey As Long, Byval lpSubKey As String, Byval dwType As Long, Byval lpData As String, Byval cbData As Long) As Long
Public Const MAX_PATH = 32
Public Const ERROR_SUCCESS = 0&
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const KEY_CREATE_SUB_KEY = &H4
Public Const SYNCHRONIZE = &H100000
Public Const KEY_SET_VALUE = &H2
Public Const READ_CONTROL = &H20000
Public Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)
Public Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
Public Const REG_SZ = 1
Public Const REG_OPTION_NON_VOLATILE = 0
'End Global BlockTranslated from WebTrek Licensing Source Code
'++LotusScript Development Environment:2:1:ReplaceStr:1:8
Function ReplaceStr (S As String, O As String, R As String) As String
' S is the input string, O is the old string, R is the replacement string
If (S = "") Then
ReplaceStr = ""
Else
n = Instr(S,O)
While (n > 0)
Mid(S,n) = R
n = Instr(S,O)
Wend
ReplaceStr = S
End If
End Function
'++LotusScript Development Environment:2:2:Initialize:1:10
Sub Initialize
iMoreInfo = False
End Sub
'++LotusScript Development Environment:2:2:ParseNetscapeBookmark:1:8
strNetPath = Inputbox("Enter the name of the Netscape directory.", "Netscape Directory", "C:\PROGRAM FILES\NETSCAPE\NAVIGATOR", 150, 150)
strBookmarkFile = strNetPath & "\BOOKMARK.HTM"
strTemp = Dir(strBookmarkFile) 'List the file.
If Lcase$(Dir(strBookmarkFile)) <> "bookmark.htm" Then 'If the file doesn't exist...
If strNetPath = "" Then
Exit Sub
Else
rval = 1 'Reset
rval = Messagebox(strMsg , 1, "Warning")
If (rval = 1) Then
iOK = 0
Else
iOK = 1
End If
End If
Else
iOK = 2
End If
Loop
If (iOK = 2) Then
lFileLen = Filelen(strBookmarkFile)
'iFileId = 1
iFileId = Freefile
'Open the file.
Open strBookmarkFile For Input Access Read As iFileId Len = lFileLen
If lFileLen >32000 Then
rval = Messagebox("The Netscape Bookmark file is too large at "+Trim(Str$(lFileLen))+ " characters. Please reduce to 32000 characters or less.", 0, "Import Bookmarks")
Exit Sub
End If
strType = "N"
strTableName = CurrentDocument.Tables(0).FileName
strSurfnet = CurrentDocument.Path & strTableName
'Use the data object to enter records.
If (Con.ConnectTo("dBASE IV")) Then
Set Qry.Connection = Con
Qry.Tablename = strSurfnet
Set RS.Query = Qry
If (RS.Execute = False) Then
Messagebox "Couldn't access file for import."
End If
Else
Messagebox "Couldn't access file for import."
End If
'Put the contents of the file in a variable.
strBookmarks = Input$(lFileLen, iFileId)
For i = 1 To lFileLen
'Reset the header if the bookmark has none.
If (Mid$(strBookmarks, i, 8) = "</DL><p>") Then
strCrntHdr = ""
End If
'Find the header.
If (Mid$(strBookmarks, i, 3) = "<H3") Then
'We've found a header.
strCrntHdr = ""
'Now let's find the header name
Do Until (Mid$(strBookmarks, i, 1) = ">")
i = i + 1
Loop
i = i+ 1 'Get next character.
'Get the header and put in a variable.
strCrntHdr = "" 'Reset variable.
Do Until (Mid$(strBookmarks, i, 1) = "<")
strCrntHdr = strCrntHdr & Mid$(strBookmarks, i, 1)
i = i+ 1
Loop
'Find the bookmark
Elseif (Mid$(strBookmarks, i, 2) = "<A") Then
'We've found a bookmark
strType = "B"
'Now let's find the URL
Do Until (Mid$(strBookmarks, i, 1) = """")
i = i + 1
Loop
i = i+ 1 'Get next character.
'Get the URL and put in a variable.
Do Until (Mid$(strBookmarks, i, 1) = """")
strCrntURL = strCrntURL & Mid$(strBookmarks, i, 1)