Worse than a cold. I got the cold after exercising for 3 days straight. Coughed and sneezed so much that I caught the cold. Ironic, isn't it? The I got constipated int he middle of it and took tablets to help things along. I had the worse cramps ever that nearly made me pass out times in the loo. Nobody home, could have broken my neck. We found out on the net how dangerous these tablets were (after the fact of course). Then After the tablets wore off, I had the opposite effect on the insides for 3 days,, no wonder I could not concentrate! Will take another week to get back to normal.
Hah! Annoy me?? Your ideas keep me going and doing something useful. Pity the remaining brain cells are so small that I keep having brain farts.
Here is the cleaned and revised sample code, hope others can use it too. I need my ugly sleep now and will fix SiteList tomorrow and upload it. Then I ave to think about a help file (oh, my aching fingers)
Code: Select all
Enumeration 1
#Window_BookMarks
EndEnumeration
#WindowIndex = #PB_Compiler_EnumerationValue
Enumeration 1
#Gadget_BookMarks_fmain
#Gadget_BookMarks_BookMarks
#Gadget_BookMarks_fcontrol
#Gadget_BookMarks_OpenFile
#Gadget_BookMarks_ExitProgram
EndEnumeration
#GadgetIndex = #PB_Compiler_EnumerationValue
Enumeration 1
#Image_BookMarks_OpenFile
#Image_BookMarks_ExitProgram
EndEnumeration
#ImageIndex = #PB_Compiler_EnumerationValue
CatchImage(#Image_BookMarks_OpenFile, ?_OPT_BookMarks_OpenFile)
CatchImage(#Image_BookMarks_ExitProgram, ?_OPT_BookMarks_ExitProgram)
DataSection
_OPT_BookMarks_OpenFile : IncludeBinary "Images\open32x32.ico"
_OPT_BookMarks_ExitProgram : IncludeBinary "Images\exit32x32.ico"
EndDataSection
Procedure.l Window_BookMarks()
If OpenWindow(#Window_BookMarks,65,76,750,600,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible)
Frame3DGadget(#Gadget_BookMarks_fmain,5,0,740,530,"")
ListIconGadget(#Gadget_BookMarks_BookMarks,15,15,720,505,"Bookmark",200,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#Gadget_BookMarks_BookMarks,1,"Title",200)
AddGadgetColumn(#Gadget_BookMarks_BookMarks,2,"Description",200)
AddGadgetColumn(#Gadget_BookMarks_BookMarks,3,"Category",100)
AddGadgetColumn(#Gadget_BookMarks_BookMarks,4,"Owner",100)
SetGadgetFont(#Gadget_BookMarks_BookMarks,LoadFont(#Gadget_BookMarks_BookMarks,"Arial",11,0))
Frame3DGadget(#Gadget_BookMarks_fcontrol,5,530,740,65,"")
ButtonImageGadget(#Gadget_BookMarks_OpenFile,15,545,40,40,ImageID(#Image_BookMarks_OpenFile))
ButtonImageGadget(#Gadget_BookMarks_ExitProgram,695,545,40,40,ImageID(#Image_BookMarks_ExitProgram))
HideWindow(#Window_BookMarks,0)
ProcedureReturn WindowID(#Window_BookMarks)
EndIf
EndProcedure
Declare OpenBookMarks()
Declare.s XMLToText(XMLString.s)
Structure ProgramData
QuitValue.i
CurrentDir.s
CurrentLine.i
EndStructure
Global Program.ProgramData
Program\CurrentDir = GetCurrentDirectory()
Procedure OpenBookMarks()
BookMarkFile.s = OpenFileRequester("Select exported browser bookmarks file", Program\CurrentDir, "HTM (*.htm;*.html)|*.htm;*.html", 1)
If BookMarkFile.s
ExpressionId.i = CreateRegularExpression(#PB_Any, "\<[^\<]+\>")
OwnerName.s = StringField(GetHomeDirectory(), 3, "\")
InFileId.i = ReadFile(#PB_Any, BookMarkFile.s)
If InFileId.i
LineCheck.i = 0
While Eof(InFileId.i) = 0
TempString.s = ReadString(InFileId.i)
LineCheck.i + 1
If FindString(TempString.s, "<DT>", 1) And FindString(TempString.s, "A HREF", 1)
MainData.i = 1
GotOne.i = LineCheck.i
TempURL.s = StringField(TempString.s, 2, Chr(34))
TempTitle.s = LTrim(RTrim(ReplaceRegularExpression(ExpressionId.i, TempString.s, "")))
TempTitle.s = XMLToText(TempTitle.s)
If LCase(Right(TempTitle.s, 4)) = ".url"
TempTitle.s = Left(TempTitle.s, Len(TempTitle.s) - 4)
EndIf
AddGadgetItem(#Gadget_BookMarks_BookMarks, -1, TempURL.s + Chr(10) + TempTitle.s + Chr(10) + "" + Chr(10) + "InterNet BookMark" + Chr(10) + OwnerName.s)
EndIf
If FindString(TempString.s, "<DD>", 1) And MainData.i = 1 And LineCheck.i = GotOne.i + 1
Description.s = LTrim(RTrim(ReplaceRegularExpression(ExpressionId.i, TempString.s, "")))
Description = XMLToText(Description.s)
MainData.i = 0
SetGadgetItemText(#Gadget_BookMarks_BookMarks, CountGadgetItems(#Gadget_BookMarks_BookMarks) - 1, Description.s, 2)
EndIf
Description.s = ""
Wend
Else
Debug "Could not open the internet bookmarks file off disk."
EndIf
Else
Debug "Nothing to process, user cancelled the file load."
EndIf
EndProcedure
Procedure.s XMLToText(XMLString.s)
TextString.s = RemoveString(XMLString.s, Chr(13))
If Left(TextString.s, 1) = Chr(10)
TextString.s = Mid(TextString.s, 2)
EndIf
TextString.s = ReplaceString(TextString.s, "&", "&")
TextString.s = ReplaceString(TextString.s, "<", "<")
TextString.s = ReplaceString(TextString.s, ">", ">")
TextString.s = ReplaceString(TextString.s, "'", "'")
TextString.s = ReplaceString(TextString.s, """, Chr(34))
TextString.s = ReplaceString(TextString.s, "€", "€")
TextString.s = ReplaceString(TextString.s, "'", "'")
;TextString.s = ReplaceString(TextString.s, Chr(10), "")
;TextString.s = ReplaceString(TextString.s, Chr(182), Chr(10))
;TextString.s = ReplaceString(TextString.s, Chr(13), "")
ProcedureReturn Trim(TextString.s)
EndProcedure
; XIncludeFile "FireFoxMarks_Constants.pb" ;
; XIncludeFile "FireFoxMarks_Windows.pb" ;
; XIncludeFile "FireFoxMarks_Mydeclarations.pb" ; All procedural declarations
; XIncludeFile "FireFoxMarks_Myconstants.pb" ; All my personal constants
; XIncludeFile "Modules\_OpenBookMarks.pbi" ; Open FireFox Bookmarks file
; XIncludeFile "Modules\_XMLToText.pbi" ; Strip illegal characters from text strings
If Window_BookMarks()
Program\QuitValue = 0
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Window_BookMarks : Program\QuitValue = 1
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case #Gadget_BookMarks_BookMarks
Select EventType()
Case #PB_EventType_LeftDoubleClick
Case #PB_EventType_RightDoubleClick
Case #PB_EventType_RightClick
Default
EndSelect
Case #Gadget_BookMarks_OpenFile : OpenBookMarks()
Case #Gadget_BookMarks_ExitProgram
EndSelect
EndSelect
Until Program\QuitValue
CloseWindow(#Window_BookMarks)
EndIf
End