Skip to main content

Topic: Bookmarks - Perl script to put folders first (Read 192 times)

Bookmarks - Perl script to put folders first
Hi all,

using Otter v1.0.81 weekly 272 (WebKit-Backend 602.1), I successfully  imported 5.000+ bookmarks/600+ folders  from Opera (with quite a long history...), well organized into folders.

Usability in Otter was far from good - folders + bookmarks wildly mixed, blindly sorted by whatever column I chose.

So I wrote a Q&D Perl script to rearrange the bookmarks file to have folders put first (recursively).
Drawback: Sorting bookmarks in bookmarks panel will return the mixup - you will have to run the script again.(In Don't-Sort-Anything-mode, if you want to preserve your sort order.)

One can specify the source + target file (.xbel expected) and opt for (not) sorting folders and/or bookmarks separately.
Just run the script in a command prompt window to see how to run it.

Anybody interested in such an intermediate solution can find the script at
     http://textix.de/perlix/bookmarks.arrange.zip

You'll have Perl installed to run the script.
Perl for Windows(free community edition) can be found at
     https://www.activestate.com/products/activeperl/downloads/

Comments/bug reports are welcome.

Happy 1 of May,
Hartmut

@Otter team:
I'm not familiar with XML/XSL/Otters handling of both (yet):
Does "the engine" support XML stylesheets/XSL Transformations?

If so, I would delve into this stuff and try to write something useful.
  • Last Edit: 2019-05-01, 10:13:09 by H. Camphausen

  • Frenzie
  • [*][*][*][*][*]
  • Administrator
Re: Bookmarks - Perl script to put folders first
Reply #1
I'm not familiar with XML/XSL/Otters handling of both (yet):
Does "the engine" support XML stylesheets/XSL Transformations?
Well sure, all you need to do is to visit some random sample, right?

https://www.w3schools.com/xml/cdcatalog_with_xsl.xml

Re: Bookmarks - Perl script to put folders first
Reply #2
> Well sure, all you need to do is to visit some random sample, right?

Apparently :-)
Thank you!

Well, Otto /does/ seem to handle XSLT fine. Fine.
Maybe it's the wrong approach but I thougth it should be possible to do the arrangement thing via XSLT, without touching the program's code.
If buried in some .xsl file, "folders first" would be the standard behaviour. Not configurable via say a toolbar button, right?

Just another thing (slightiy OT):
I wrote a user JS to filter out any (annoying) HTML-styling, revealing working links instead of JS-onclick-quasilinks (my default is JS: Off).
Currently it's just a test script about how to manipulate the document tree, it has to be (de)activated via the plugins-panel, requiring a restart of the browser to work. Hmm.

Question: How can I make a user JS into something that works on the current window/current document context - on demand/if some setting is 'set' only?
- How do I call a script via a toolbar button/context menu entry, providing the current document's URL as a parameter?
- Is there any documentation of the "parameters" , "hints" etc. for custom actions, e. g. placed in webWidget.json?
- Is there any documentation on how to read/set/unset Otter's settings via JS?

mfg,
Hartmut