STUSK (Stupid site keeper)

Share your advanced PureBasic knowledge/code with the community.
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: STUSK (Stupid site keeper)

Post by Perkin »

Thanks Fangbeast

:lol:
Now all we need to add is
1. Something
2. A whadyoucallit
3. Something else
4. A thingyamyjig
5. The other thing
6. An oujamadoojy
7. Anythingelse
%101010 = $2A = 42
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: STUSK (Stupid site keeper)

Post by Fangbeast »

Perkin wrote:Thanks Fangbeast

:lol:
Now all we need to add is
1. Something
2. A whadyoucallit
3. Something else
4. A thingyamyjig
5. The other thing
6. An oujamadoojy
7. Anythingelse
1. Remember underpants
2. Retrieve brain
3. Put a smeg in srod's underpants
4. Rotate hamster crop.
5. Eat three thingummybobs for late breakfast
6. Run screaming around in circles.
7. Cheat at printing by using a web template that I once made for my address book software.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: STUSK (Stupid site keeper)

Post by Fangbeast »

SiteList, v2.0 released. Major changes to searching and data form and fields available.


-----------
Main form.
-----------


Changing the owner combo arbitrarily displays all records from that owner, regardless of all other combo settings.

Changing the category combo arbitrarily displays all records from that category regardless of all other combo settings.

Selecting any field to search instantly displays all records according to owner, category, field, search type and string displayed.

Selecting any search type instantly displays all records according to owner, category, field, search type and string displayed.

Typing any search string instantly displays all records that match the current owner, category, search field, search type and string displayed.


-----------
Program settings.
-----------


SiteList saves all last used owner, category, search field, search type and last used string and restores them at program start.


-----------
Data form
-----------


There are now 13 fields you can choose from and arbitrarily assign labels to. The first four fields are filled by default with generic labels.


The form has been resized and re-arranged to accomodate them and the note window moved to another tab.

All hardcoded field labels have been removed except for the 4 default that you can change anyway. By pressing the left pointing arrow next to a field, you can type in your own label (case adjusted). Press ENTER to set it. If the field was not changed, pressing ENTER just restores the previous text.

All label names are saved to the database. When you enter the data form again, previous field labels are added to the popup combo box for you to choose from, or just type in another one.

Link in first post. Someone please test this program??? I need intelligent feedback (not srod's steaming underpants)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: STUSK (Stupid site keeper)

Post by Perkin »

I'll give the new version a try soon, just installing a new sytem :D .
%101010 = $2A = 42
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: STUSK (Stupid site keeper)

Post by Fangbeast »

Perkin wrote:I'll give the new version a try soon, just installing a new sytem :D .
Painful. I have to reinstall windows 7 as it keeps crashing randomly after I used their system file checker to repair some files:):) Got to love MS.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: STUSK (Stupid site keeper)

Post by rsts »

Hi Fangles,

Is that Suzie speaking sponsorship on your web page from you, or is it a site generated ad?

cheers
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: STUSK (Stupid site keeper)

Post by Perkin »

Working great Fangles.

One thing I'd like to suggest (yes another one)
When Importing a list, would it be possible to import a *.hml|*.html file exported by IE or Firefox
(Just site/address - ignoring add_date etc.)
%101010 = $2A = 42
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: STUSK (Stupid site keeper)

Post by Fangbeast »

rsts wrote:Hi Fangles,

Is that Suzie speaking sponsorship on your web page from you, or is it a site generated ad?

cheers
Yes, it's my lovely wife wanting sponsorship for the breast cancer march:):) Oh, oh, we have been found!!! Oh no, srod's steaming underpants will get us!!!!
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: STUSK (Stupid site keeper)

Post by Fangbeast »

Perkin wrote:Working great Fangles.

One thing I'd like to suggest (yes another one)
When Importing a list, would it be possible to import a *.hml|*.html file exported by IE or Firefox
(Just site/address - ignoring add_date etc.)
I've no experience 'scraping' a web page for data but if you have a sample (it would all have to be the same format from all people or I would be in even more trouble than I am now!!), then I could give it a go.

No harm trying to expand my tiny brain right?
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: STUSK (Stupid site keeper)

Post by Perkin »

My fault, I meant an exported favourites list file.

If I could import them, then go through the list removing unwanted ones, that would be great.
%101010 = $2A = 42
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: STUSK (Stupid site keeper)

Post by Fangbeast »

My fault, I meant an exported favourites list file.
Okay, I am now very confused. Do you mean exported from my program, or from somewhere else?

D'oh!! Never mind. I will export some of my FireFox favourites and see what I can do with it:):):)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: STUSK (Stupid site keeper)

Post by Perkin »

Fangbeast wrote:
D'oh!! Never mind. I will export some of my FireFox favourites and see what I can do with it:):):)
Yep that's the one, export from firefox (or IE) as html, import into Sitelist.
Should have explained clearly to start with, :lol: but as usual - I knew what I meant. :lol:
%101010 = $2A = 42
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: STUSK (Stupid site keeper)

Post by Fangbeast »

Perkin wrote:
Fangbeast wrote:
D'oh!! Never mind. I will export some of my FireFox favourites and see what I can do with it:):):)
Yep that's the one, export from firefox (or IE) as html, import into Sitelist.
Should have explained clearly to start with, :lol: but as usual - I knew what I meant. :lol:
LOL!! I never know what I mean.

Just whipped up a sample module to read and parse a FireFox bookmarks file and it works well.

Did you want the comments imported for each link as well if they exist? (Might have to beat the code up for a while if so)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: STUSK (Stupid site keeper)

Post by Perkin »

I think as long as the Title and the URL are imported, that should do.
( :lol: At least until I later complain that the comment isn't stored as well :lol: )
%101010 = $2A = 42
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: STUSK (Stupid site keeper)

Post by Fangbeast »

Perkin wrote:I think as long as the Title and the URL are imported, that should do.
( :lol: At least until I later complain that the comment isn't stored as well :lol: )
Perkin, try the code below (grab 2 of your own button graphics) on a copy of your exported firefox bookmarks and tell me if it works for you as it should. It works here.

P.s. I made the "Owner name" = currently logged in user and the Category to "FireFox BookMarks"

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,"Description",200)
        AddGadgetColumn(#Gadget_BookMarks_BookMarks,2,"Category",150)
        AddGadgetColumn(#Gadget_BookMarks_BookMarks,3,"Owner",150)
        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()

Structure ProgramData
  QuitValue.i                                                                           ; Program quit flag
  CurrentDir.s                                                                          ; The current program startup directory
EndStructure

Global Program.ProgramData                                                             ; Structure to hold program data

Program\CurrentDir    = GetCurrentDirectory()                                           ; Get the current directory name

Procedure OpenBookMarks()
  BookMarkFile.s = OpenFileRequester("Select FireFix Bookmarks file", Program\CurrentDir, "HTM (*.htm)|*.htm;*.html", 1)
  If BookMarkFile.s
    ExpressionId.i = CreateRegularExpression(#PB_Any, "\<[^\<]+\>")
    OwnerName.s = RepQuote(StringField(GetHomeDirectory(), 3, "\"))
    InFileId.i = ReadFile(#PB_Any, BookMarkFile.s)
    If InFileId.i
      While Eof(InFileId) = 0
        TempString.s = ReadString(InFileId.i)
        If FindString(TempString.s, "<DT>", 1) And FindString(TempString.s, "A HREF", 1)
          TempURL.s   = StringField(TempString.s, 2, Chr(34))
          TempTitle.s = LTrim(RTrim(ReplaceRegularExpression(ExpressionId.i, TempString.s, "")))
          AddGadgetItem(#Gadget_BookMarks_BookMarks, -1, TempURL.s + Chr(10) + TempTitle.s + Chr(10) + "FireFox BookMark" + Chr(10) + OwnerName.s)
        EndIf
      Wend
    EndIf
  EndIf
EndProcedure

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_OpenFile     : OpenBookMarks()
          Case #Gadget_BookMarks_ExitProgram  : Program\QuitValue = 1
        EndSelect
    EndSelect
  Until Program\QuitValue
  CloseWindow(#Window_BookMarks)
EndIf
End
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Post Reply