My (Simple) Bookmark Manager

Everything else that doesn't fall into one of the other PB categories.
User avatar
susan
User
User
Posts: 19
Joined: Mon Aug 08, 2022 4:06 am

My (Simple) Bookmark Manager

Post by susan »

This is my first utility in PureBasic written from scratch with multiple windows (my previous experiments have been basic). It was an exercise in learning more about PureBasic and the IDE. It's a simple (no drag and drop) bookmark manager that is specifically designed to import and work with bookmarks exported from the Start.me online homepage site.

Comments about the program.
  • The built-in Form Designer was used to see what it's like and how easy could I make a simple UI without additional tools, and to work within the bounds of the event loop code that it generates.
  • I chose to use #PB_Any at every possible opportunity. A slightly tricky result of this was trying different and then deciding on a set of rules for naming that made sense to me for the global variables.
  • There is no error checking that the file to import is from https://start.me (or in the expected format), or that the number of bookmarks is less than 5000.
  • Actually, there aren't rigorous checks anywhere (like is the URL valid?), I know that is bad, but it is what it is!
  • It's a "portable" program and assumes that the folder it is running from is writeable, and that is the only folder that data is stored in.
  • I should find out how to make "default" buttons in the windows, so the Enter key can be used to make things happen. And generally learn about making keyboard shortcuts.
  • I plan to learn how to include the PNG files in the program (if that's possible), so they are not separately in the folder.
  • I would like to launch the browser with a double click on a URL in the TreeGadget, but don't know how to do that, yet.
  • The TreeGadget gets redrawn totally from scratch when a new item is added (or deleted). It would be better if a new item is just added to the existing gadget items.
  • Importing overwrites all the existing bookmarks. It might be nice for the import to append to the bookmarks already there, or at least have that as an option.
  • Threads are not used at all! If the UI freezes, please be patient while it completes. Less than ideal, but I already had to absorb a lot just to get this far, and I didn't have the motivation to learn more about threads for a personal project.
Below are links to a zip file with the program (for Windows), or if you prefer a file with all the sources so you can make it yourself.

Source:
https://workdrive.zohoexternal.com/exte ... bb51376019

Program:
https://workdrive.zohoexternal.com/exte ... dae99eb352
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 506
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: My (Simple) Bookmark Manager

Post by Mindphazer »

Hi Susan,
nice work !

You can include images in your program using CatchImage() and IncludeBinary like this example :

Code: Select all

  If OpenWindow(0, 0, 0, 256, 256, "CatchImage", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CatchImage(0, ?Image_Start, ?Image_End - ?Image_Start)
      ImageGadget(0, 0, 0, ImageWidth(0), ImageHeight(0), ImageID(0))
      Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
    EndIf
  EndIf

  DataSection
    Image_Start:
      IncludeBinary #PB_Compiler_Home+"Examples\Sources\Data\Background.bmp"
    Image_End:
  EndDataSection

MacBook Pro 16" M4 Pro - 24 Gb - MacOS 26.1 - Iphone 17 Pro Max - iPad at home
...and unfortunately... Windows at work...
miso
Enthusiast
Enthusiast
Posts: 516
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: My (Simple) Bookmark Manager

Post by miso »

Thanks for sharing, Susan! Good work.
User avatar
mk-soft
Always Here
Always Here
Posts: 6396
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: My (Simple) Bookmark Manager

Post by mk-soft »

Really good for a first project. ;)

Regarding FormDesigner:
I prefer the default setting without #PB_Any. So everything with named enumeration and constants.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6396
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: My (Simple) Bookmark Manager

Post by mk-soft »

P.S.

The FormDesigner has a bug with Windows Flags under PB v6.21.
You can download the PureBasic-IDE patch from my server here.
Link: OneDrive - PureBasic IDE Patches
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
susan
User
User
Posts: 19
Joined: Mon Aug 08, 2022 4:06 am

Re: My (Simple) Bookmark Manager

Post by susan »

Thank you for the positive feedback. I have lost track of the countless hours reading and re-reading the manual, lurking on and searching the forums, and slowly understanding the samples. Hoping to get it right, (or just good enough.)

Will add the CatchImage method (which looks very clever, and I don't think I would have discovered easily myself) to remove the separate files and install that IDE patch!

Maybe I can redo the program with the enumeration and constants way of doing things, and see which I prefer?
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5517
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: My (Simple) Bookmark Manager

Post by Kwai chang caine »

Nice tool, thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
boddhi
Enthusiast
Enthusiast
Posts: 526
Joined: Mon Nov 15, 2010 9:53 pm

Re: My (Simple) Bookmark Manager

Post by boddhi »

Hello,
susan wrote: I plan to learn how to include the PNG files in the program (if that's possible), so they are not separately in the folder.
As mentioned previously, there are include methodx.
Also, another method exists (than can be use when posting on the forum too :wink: ) :

First source on english forum
Second one on german forum
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
User avatar
susan
User
User
Posts: 19
Joined: Mon Aug 08, 2022 4:06 am

Re: My (Simple) Bookmark Manager

Post by susan »

boddhi wrote: Tue Nov 18, 2025 2:55 pm there are include methodx
Have used the CatchImage with success.
User avatar
susan
User
User
Posts: 19
Joined: Mon Aug 08, 2022 4:06 am

Re: My (Simple) Bookmark Manager

Post by susan »

Here is the latest source to My Bookmark Manager. Improvements are:
  • The toolbar icons are now included in the executable and do not need to be in separate files. To do this, I had to copy the lines generated by the Form Designer for the Toolbar into my own code because I don't think the Form Designer can use the DataSection information for the images.
  • Simple keyboard shortcuts of Enter and Esc have been added to the dialogue boxes.
  • Show an error message if an attempt is made to import too many bookmarks.
  • Showing the percent progress when importing.
  • The event loop no longer gets blocked when using the File, Import command. Didn't use threads to do this, but instead switched from using For loops to While loops, that only loop for a limited amount of time before ending the event and using globals to keep track of where they are up to for the next time round.
  • Started using v as a prefix for global variables that I want to think of as private, even though they are global.
  • Used the List instead of an Array for breaking up the import text into lines. No real advantage, but just an exercise in learning something new. I don't really understand the List() syntax and am relying heavily on copying from the Help. It's like a list is something like a function, but also a variable at the same time, and can be a magic sort of parameter too. I don't quite get it, but it works!
Realised that I cannot use a List in place of the bookmarks Array because the way I have loops within loops and am running through all the items in the array multiple times with more than one index. Don't think that can be done with a list.

Learning a lot and having fun!

Source only:
https://workdrive.zohoexternal.com/exte ... f0346f0c8e
User avatar
minimy
Enthusiast
Enthusiast
Posts: 733
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: My (Simple) Bookmark Manager

Post by minimy »

Hi Susan, thank you so much for sharing.
Your app is really interesting. Tested in PB6.30beta3 and works perfectly.
I think you can use list as well, but it can be hard to do.
Something like:

Code: Select all

For p= 0 to ListSize(list())-1
  oldP= p
  SelectElement(list(),p+10)
  bla, bla...
  SelectElement(list(),oldP)
  bla, bla..
Next p
But your way is better and clean, i think. Good job!
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
mk-soft
Always Here
Always Here
Posts: 6396
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: My (Simple) Bookmark Manager

Post by mk-soft »

The advantage of LinkedList is that you can easily load files with an unknown number of lines without constantly enlargeing an array.

Add content at the beginning, at the end or in between without having to move the data as with an array.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply