Common internal scripting code

33 views
Skip to first unread message

Richard Blake

unread,
Jul 25, 2024, 11:46:09 AM7/25/24
to GEDitCOM II Discussions
Whilst I am developing scripts using the internal scripting language, I am coming up with code (subroutines) that would be useful in multiple scripts. Is there any way of having a common file that can be called by other scripts/browser styles. A bit like the GEDitCOMII.py for Python scripting.

Regards, Richard

John Nairn

unread,
Jul 25, 2024, 12:14:35 PM7/25/24
to geditcom-ii-discussions@googlegroups.com geditcom-ii-discussions@googlegroups.com
Yes there is and I use it all the time. For details see the “Load” command in the “GENerel Language Reference” help in GEDitCOM Editor To see it in action, open the web site extensions.

You can also mix loading subroutines from files with subroutines in the internal script. When writing the web site script, I started with them in the main script. Once each section was done, I split that out to separate files. That extension loads multiple files with subroutines.

There is currently no way to have a repository of scripts (like a python module) that all extensions could use, but you can emulate that by just including a module of subroutines in each extension. In other words, the “Load” command only looks for subroutine files within the extension itself Maybe I should change that in the future to store subroutines in folder with the python module too.

Regards,
John

On Jul 25, 2024, at 8:46 AM, Richard Blake <ric...@blake.uk.com> wrote:

Whilst I am developing scripts using the internal scripting language, I am coming up with code (subroutines) that would be useful in multiple scripts. Is there any way of having a common file that can be called by other scripts/browser styles. A bit like the GEDitCOMII.py for Python scripting.

Regards, Richard

--
You received this message because you are subscribed to the Google Groups "GEDitCOM II Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geditcom-ii-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geditcom-ii-discussions/f51bb076-d20c-4b04-ab67-f5ad45932a69n%40googlegroups.com.

Message has been deleted

Richard Blake

unread,
Jul 25, 2024, 1:16:25 PM7/25/24
to GEDitCOM II Discussions
Hi John

Yes I'm already using the Load command in my scripts. What I was looking for was having a place where scripts can load files from a central location as well as locally so that if I update a subroutine used by multiple scripts I only have to do that in one place. So something like you describe in your final paragraph.

Thanks, Richard

John Nairn

unread,
Jul 25, 2024, 2:08:20 PM7/25/24
to geditcom-ii-discussions@googlegroups.com geditcom-ii-discussions@googlegroups.com
I will look into that. I am preparing to post new build with some minor fixes and maybe that could be in too.

John

--
You received this message because you are subscribed to the Google Groups "GEDitCOM II Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geditcom-ii-discu...@googlegroups.com.

John Nairn, Developer

unread,
Jul 27, 2024, 11:49:40 AM7/27/24
to GEDitCOM II Discussions
It was fairly easy and I added option for next posting (maybe soon). In brief, like Python modules, you can store internal scripts in the "Modules" folder(s) in the application support folders. When you use "Load" command it will look for the file to include in the current extension, in the "User" domain "Modules" folder, and the "System" domain "Modules" folder in that order, and use the first one it finds.

Now I should think up some internal script methods for a default module to include with installations (like the current Python module).

John
Reply all
Reply to author
Forward
0 new messages