Shared Scripts

144 views
Skip to first unread message

robertp...@gmail.com

unread,
Jul 11, 2022, 10:39:27 AM7/11/22
to mementodatabase
How do I reference a script that I saved as shared from within another script?

Er Mo

unread,
Jul 11, 2022, 3:18:07 PM7/11/22
to mementodatabase
Hallo
Versuche den Namen von den Skript

Hi
Try the name of the script

Ernst

Bill Crews

unread,
Jul 11, 2022, 3:39:17 PM7/11/22
to Er Mo, mementodatabase
If I knew anything about it, I'd happily respond, but unfortunately, I don't.

--
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 on the web visit https://groups.google.com/d/msgid/mementodatabase/18d829a2-f041-4ea6-bc61-d7ceef3e4ce0n%40googlegroups.com.

Gilles Mons

unread,
Jul 11, 2022, 11:05:01 PM7/11/22
to robertp...@gmail.com, mementodatabase
Bonjour,

Il suffit de crée une function.

Exemple :

function test(t){

if ( t == true )
{
message("test ok");
};
};

et dans un script si je veux utiliser le script partagé j'écris :

test(true);

Ce qui exécutera le script partagé.

Attention ⚠️  les variables utiliser dans les scripts partagés, doivent être présentes dans le script qui utilise le script partagé.


Hello,

Just create a function.

Example :

function test(t){
if ( t == true )
{
message("test ok");
};
};

and in a script if I want to use the shared script I write:

test(true);

Which will run the shared script.

Warning ⚠️ the variables used in shared scripts must be present in the script that uses the shared script.


Hallo,
Erstellen Sie einfach eine Funktion.

Beispiel :

function test(t){
if ( t == wahr )
message("Test ok");
};
};

und in einem Skript, wenn ich das freigegebene Skript verwenden möchte, schreibe ich:

test (true);

Dadurch wird das freigegebene Skript ausgeführt.

Warnung ⚠️ Die in freigegebenen Skripten verwendeten Variablen müssen in dem Skript vorhanden sein, das das freigegebene Skript verwendet.

Gilles.

Le lun. 11 juil. 2022, 16:39, robertp...@gmail.com <robertp...@gmail.com> a écrit :
How do I reference a script that I saved as shared from within another script?

--
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.

Bill Crews

unread,
Jul 12, 2022, 1:21:04 AM7/12/22
to Gilles Mons, robertp...@gmail.com, mementodatabase
I think I understand you... The function test(conjecture) is defined in a Shared script, and I can think of the shared script as being pasted onto the front of (for instance) a trigger script I'd write. Variables & functions, then, are already defined when the trigger script starts to run.

It most likely doesn't work exactly this way, but I think the trigger script can't tell the difference. If I were to write an action script
that needed to use the same shared function, it too would work as if the shared script were glued onto the front of the action's script space, and the action script would then follow that.

This implies that all the variable names, function names, or any other names defined in all shared scripts are predefined in all the other scripts in the library, and they would all (have to) use those names to access items in the shared script. So, you could use a shared script to predefine things like...

    var e = entry();

Maybe... var entries = lib().entries();
...though that's generally an extra unneeded definition in trigger scripts.

I presume that if I had 2 or more shared scripts, they would just be concatenated and effectively copied onto the front of each other non-shared script with one following the other.

It takes more words to describe than it does to do it in the first place, doesn't it? It's really simple and works, so long as the one shared "JavaScript Library" made up of the concatenation of all the shared scripts has everything I need. If I need more, I can use the Add JavaScript libraries... feature of JavaScript fields, triggers, & actions
to add other JavaScript libraries I might need that are stored elsewhere (probably in GitHub), including the JavaScript Library included in Memento called moment.min.js.

I think I got all that right. If I didn't, please let either the forum or me individually know what you believe is right, or what you've learned from your experiences.


robertp...@gmail.com

unread,
Jul 12, 2022, 8:54:19 AM7/12/22
to mementodatabase
OK I see what I did. The shared scripts are available only to Trigger and Action Scripts. I tried to reference the shared script from a JavaScript field definition and it did not work there. Thanks for all of your answers.

Er Mo

unread,
Jul 12, 2022, 2:47:11 PM7/12/22
to mementodatabase
Hallo
Wenn du ein Skript haben willst das du in jeder Bibliothek aufrufen kannst , muss du es im Internet speichern . Dazu kannst du GitHub oder eine belibige Webspeicher verwenden . Du muss in den Skript den Weg freigeben .

Hi
If you want a script that you can call in any library, you have to store it on the web. You can use GitHub or any web storage for this. You have to release the path in the script.

Ernst

Bill Crews

unread,
Jul 12, 2022, 8:24:49 PM7/12/22
to Er Mo, mementodatabase
Wenn Sie sagen "in einer beliebigen Bibliothek anrufen", nehme ich an, dass der Aufruf von (in) einer Bibliothek stammt, die von GitHub hinzugefügt wurde, richtig?  Danke für die Information.

Ist die Reihenfolge der Adds wichtig?  Soll Bibliothek A vor Bibliothek B hinzugefügt werden, wenn B A aufruft?  Ich kann mir vorstellen, dass das so ist.
__________

When you say "call in any library", I take that the call would be from (in) a library added from GitHub, right? Thanks for the info.

Is the sequence of adds important? Should library A be added before library B if B calls A? I can imagine that to be the case.


Er Mo

unread,
Jul 13, 2022, 2:44:00 PM7/13/22
to mementodatabase
Hallo Bill
Ich habe den JS Text ( Skript ) in eine Text Datei geschriben und diese in JS Umbenannt . Das Skript beinhaltet " Funktionen " , die von eine Skript in einer Bibliothek aufgerufen werden Können . Dazu muss in dieser Bibliothek der Pfahd zu JS Datei angegeben werten .

Hello Bill
I wrote the JS text (script) in a text file and renamed it JS. The script contains "functions" that can be called from a script in a library. To do this, the path to the JS file must be specified in this library.

Ernst

Gilles Mons

unread,
Jul 13, 2022, 9:02:33 PM7/13/22
to Er Mo, mementodatabase
Hallo ErMo,

Haben Sie eine Beispielbibliothek zum Teilen  ?

Vielen Dank,

Hello ErMo,

Do you have an example library to share?

Thanks,

Gilles.

Er Mo

unread,
Jul 14, 2022, 2:41:50 PM7/14/22
to mementodatabase
Hallo Gilles
Ich habe ein System entwickelt um jedes Gerät ( Nicht nur den User ) zuerkennen . Dazu habe ich eine Bibliothek ( A1 ) mit einer Zahl auf den Handy gespeichert die NICHT in die Cloude geladen wird . In der 2 Bibliothek ( B2 ) ist eine Liste mit den Zahlen und den Namen von den Handys . In den 3 Bibliotheken wird mittels Funktion der Name ermittelt . Diese Funktiun habe ich im Internet gespeichert . So muss ich in Jeder Bibliothek in der ich den Namen möchte nur den Pfaht von Internet angeben und die 2 Bibliotheken freigeben .
Werde zum Wochenende ein Test zusammen stellen .

Bonjour Giles
J'ai développé un système pour reconnaître n'importe quel appareil (pas seulement l'utilisateur). Pour cela, j'ai enregistré une bibliothèque (A1) avec un numéro sur le téléphone portable qui n'est PAS chargé dans le Cloude. Dans la bibliothèque 2 (B2) se trouve une liste avec les numéros et les noms des téléphones portables. Le nom est déterminé dans les 3 bibliothèques à l'aide d'une fonction. J'ai enregistré cette fonction sur Internet. Ainsi dans chaque bibliothèque dont je veux le nom je n'ai qu'à indiquer le chemin depuis Internet et activer les 2 bibliothèques.
Je ferai un test pour le week-end.

Ernst

Gilles Mons

unread,
Jul 15, 2022, 1:21:50 AM7/15/22
to Er Mo, mementodatabase
Bonjour Er Mo,

Merci pour votre réponse, j'attends avec impatience votre exemple....

Bonne fin de semaine,

Hallo Ermo,

Danke für deine Antwort, ich freue mich auf dein Beispiel....

Gutes Wochenende,

Hello ErMo,

Thank you for your answer, I look forward to your example....

Good weekend,

Gilles.

Er Mo

unread,
Jul 16, 2022, 2:01:11 PM7/16/22
to mementodatabase
Hallo
Hier die Bibliotheken . In C3 sind 2 Aktionsskripte . In abc ist die Funktion abc() enthalten und in " Internet " ist der Aufruf von der Funktion aus den Internet aus . Beachte die Erlaubnisse für die Bibliotheken A1 und B2 , weiters die hinzufügung von der"  abc.js " Datei aus den Internet.

Hi
Here the libraries. In C3 are 2 action scripts. The abc() function is contained in abc and the function call from the Internet is in "Internet". Note the permissions for the A1 and B2 libraries, and the addition of the "abc.js" file from the web.

Salut
Ici les bibliothèques. En C3 sont 2 scripts d'action. La fonction abc() est contenue dans abc et l'appel de fonction depuis Internet est dans "Internet". Notez les autorisations pour les bibliothèques A1 et B2 et l'ajout du fichier "abc.js" à partir du Web.

http://libs.mobi/s/9HXVJjRng       --> A1
http://libs.mobi/s/yxq94BsAU       ---> B2

Ernst

Gilles Mons

unread,
Jul 18, 2022, 1:40:07 AM7/18/22
to Er Mo, mementodatabase
Bonjour Er Mo,

Merci pour cette exemple.

Hallo ErMo,

Danke für dieses Beispiel.

Hello ErMo,

Thanks for this example.

Gilles.

Reply all
Reply to author
Forward
0 new messages