Tapping List Entry to launch Hyperlink?

255 views
Skip to first unread message

Gabriel

unread,
Dec 22, 2024, 7:21:27 PM12/22/24
to mementodatabase
For Memento on Android, I've created a Library for managing my web bookmarks, including a field for the Site Name (as a Text data type), and a separate field for the URL (as a Hyperlink data type). I have set the database to List View, and only the site name is visible for each entry. Is there a way to click on the entry to launch the Hyperlink, rather than having to click into the entry to then click on the Hyperlink field?

Mmm

unread,
Dec 23, 2024, 2:12:19 AM12/23/24
to mementodatabase
Как открыть ссылку в браузере по умолчанию:

Добавьте скрипт Действие записи в списке и установите для него фильтр, когда поле с URL не пустое. 

Шаблон с примером:

понедельник, 23 декабря 2024 г. в 03:21:27 UTC+3, Gabriel:

Mmm

unread,
Dec 23, 2024, 2:19:56 AM12/23/24
to mementodatabase
Ошибся со ссылкой... 

Ссылка на скрипт:
понедельник, 23 декабря 2024 г. в 10:12:19 UTC+3, Mmm:

Gabriel

unread,
Dec 23, 2024, 11:02:36 AM12/23/24
to mementodatabase
I was able to get this to work. Thank you!

David Gilmore

unread,
Dec 23, 2024, 11:13:11 AM12/23/24
to mementodatabase
I actually do something similar. I have a library (called "Databases") that has the list of all of my other libraries. The Databases library has the name, last date and time the library was opened, and other useful information about the library. "Databases" can also be utilized to hold global data for libraries that need them. The other reason for Databases to exist is that it also acts like a library launcher.

There are several ways to "launch" the database. You could create a trigger on "Opening an Entry View Card", "Before window display". The problem with this method is that is kind of locks out being able to view or edit the actual entry.

The method I use for launching is to create a checkbox field ("Launch") in "Databases", and make that checkbox editable in the List screen. The check box will appear to the left in the list view. The user then checks that box to launch the library. Then create a trigger "Updating a field", "Before saving the entry". The code in that trigger is:

var e = entry();
if (e.field("Launch")) { // see if launch has been set
  e.set("Launch", false);  // Reset launch for next time
  libByName(e.field("Name")).show(); // Show designated library
}

You can use instead the hyperlink code Mmm showed you.

RG T

unread,
Dec 23, 2024, 2:27:02 PM12/23/24
to David Gilmore, mementodatabase
Bonjour David,
Je rebondis sur votre dernier post. En fait j'ai une ébauche de bibliothèque qui compile toutes mes autres bibliothèques comme la votre. Je vais intégrer votre script, par contre je n'ai pas résolu l'affichage de la date et heure de modification ainsi que s'il est possible d'afficher le nombre d'enregistrements, d'ailleurs si c'est possible? our l'instant je fais ça en manuel.
J'aimerai bien voir votre façon de faire.
Merci
TRG

--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mementodatabase/06eb02bd-ddc6-4db8-b18e-38d783f8e257n%40googlegroups.com.

David Gilmore

unread,
Dec 24, 2024, 11:01:47 AM12/24/24
to mementodatabase
TRG,

I have each library update the "Databases" library LastOpened field when that library opens (using an OpenLibrary trigger). That way the date last opened is set in "Databases", and no polling of each library is necessary. I use the Moment library to format the datetime when displaying it in the list view.

I have not done the number of records. And I do not see a way of fetching the number of records from externally. I guess you could have the library update the "Databases" library each time it adds or deletes entries. Seems like a lot of overhead though.

Bill Crews

unread,
Dec 24, 2024, 11:27:31 AM12/24/24
to David Gilmore, mementodatabase
Get library with lib(), libByName(), or libById(). Then...

let entries = lib.entries();
let nentries = entries.length;

I know of no way to do this without opening & fetching the entire library into an array. 


David Gilmore

unread,
Dec 24, 2024, 6:21:31 PM12/24/24
to mementodatabase
What Bill showed you is the simple way to do get the count. But is does have one drawback, in that fetching those entries causes that library to be opened, which means your last opened date would be set to the current time and date.

Bill Crews

unread,
Dec 24, 2024, 6:31:58 PM12/24/24
to David Gilmore, mementodatabase

Mmm

unread,
Dec 25, 2024, 2:13:44 AM12/25/24
to mementodatabase
>>> But is does have one drawback, in that fetching those entries causes that library to be opened, which means your last opened date would be set to the current time and date.
 
Не согласен с этим утверждением. 

Событие открытие библиотеки не наступает. 
А время последнего открытия библиотеки предлагаете определять триггером этого события (открытие библиотеки). 
Проверьте скрипт Билла в условиях своих библиотек. 

среда, 25 декабря 2024 г. в 02:31:58 UTC+3, bill....@gmail.com:

David Gilmore

unread,
Dec 25, 2024, 10:46:54 AM12/25/24
to mementodatabase
Mmm,

I have tried it. Even accessing a library via a link will trigger the open.

RG T

unread,
Dec 25, 2024, 11:18:07 AM12/25/24
to David Gilmore, Mmm, mementodatabase
Bonjour,
Je ne donne pas mon avis, il s'agit de simples constatations. Je suis peut-être hors sujet.
J'ai téléchargé la base exemple de Mmm. Si je cliques sur l'icône la page web s'ouvre. En refermant je consulte la vignette la date et heure sont identiques qu'avant ouverture. J'ouvre la base sans rien modifier, là aussi rien ne change sur la vignette. Par contre si je modifie l'enregistrement, la date et heure change. Voilà simple constatations je ne suis pas assez performant en javascript il y a peut être des choses qui m'échappent.
Bonnes fêtes.
TRG

Mmm

unread,
Dec 25, 2024, 11:37:57 AM12/25/24
to mementodatabase
Вероятно есть недопонимание.

Билл указал на способ определения количества записей в библиотеке. Это общеизвестные, задокументированные приемы...
https://groups.google.com/g/mementodatabase/c/2CX4UFCDqAc/m/1sqwnw1pAwAJ

Вы указали на недостаток, якобы этот способ приводит к открытию инспектируемой библиотеки.
https://groups.google.com/g/mementodatabase/c/2CX4UFCDqAc/m/4SExEKV_AwAJ

А здесь описан способ, как обновить время открытия библиотеки с помощью триггера открытие библиотеки.
https://groups.google.com/g/mementodatabase/c/CMLfDL7wxvE/m/FCFGmAhpAwAJ

Привожу пример работы базовой и рядовой библиотек.
Базовая библиотека:
1. пределяет количество записей в рядовой библиотеке,
2. создает новую запись в рядовой библиотеке,
3. открывает рядовую библиотеку.

Ни в первом, ни во втором случае не срабатывает триггер открытие библиотеки в рядовой библиотеке.
Он срабатывает только в случае ее открытия и заполняет поле "LastOpen" в базовой библиотеке.

Возможно после тестирования, Ваше мнение изменится.

Библиотеки для тестов во вложении.
Алгоритм:
1. Установить библиотеки. Записи создавать не нужно.
2. Открыть библиотеку Test lib.
3. Перейти в библиотеку All bases и выполнить скрипты для записи "Test lib".

среда, 25 декабря 2024 г. в 19:18:07 UTC+3, trg...@gmail.com:
All_bases.mlt2

Mmm

unread,
Dec 25, 2024, 11:46:24 AM12/25/24
to mementodatabase
Библиотека из этого сообщения 

не определяет время последнего открытия библиотеки.
Она определяет время последней модификации любой из записей библиотеки и совпадает с первой записью в ИСТОРИИ.

Мы с Давидом обсуждаем время последнего открытия библиотеки.

среда, 25 декабря 2024 г. в 19:37:57 UTC+3, Mmm:

David Gilmore

unread,
Dec 25, 2024, 12:25:43 PM12/25/24
to mementodatabase
Okay, my previous test must not have been accurate. Coming in through a link does not trigger then "openlibrary" trigger. Oops. Everything else seems to.

My testing was done by putting the following code in an "OpenLibrary" trigger, then tried the different access methods for that library.

message(lib().title + " has just been opened");
Reply all
Reply to author
Forward
0 new messages