PDA

View Full Version : How to automatically execute code after an extension is loaded



jkeller
November 19th, 2025, 15:53
Hi - I'm trying to modify my extension (5E) so that it executes some set-up code when the session starts.

I tried adding a call in the onInit method, but it doesn't seem to get called (perhaps some kind of load-order issue?).

I'd like it to run after my extension is fully loaded, if that's possible.

Can anyone point me to another extension which does this, or suggest another method that would be more appropriate? Thanks!

Trenloe
November 19th, 2025, 16:18
Scripts can be attached globally (in extension.xml) to a windowclass or to a control - onInit will get called when the script section is first setup, which will depend on where the <script> definition is.

If you have a Global Script definition (defined in extension.xml) then you can use onTabletopInit which will run once the FG desktop has been initialized.