« FileMaker Stammtisch … | Home | FileMaker 19.3.2 rele… »

Register MBS Plugins in a Xojo Worker

If you use a Worker in Xojo to run code on multiple cores, you basically get a helper console application to do the work. Workers are launched in Xojo as needed to process whatever jobs you provide. Since workers have no open or started event, you can't easily put the registration code there (see feedback case 62409). But you can use static keyword to get a globally stored, but locally defined boolean to check status:

EventHandler Function JobRun(jobData As String) As String Static registered As Boolean = False If Not registered Then If Not RegisterMBSPlugin("License Name", "MBS Complete", 202108, "xxx") Then System.DebugLog "MBS Plugin serial not valid?" End If End If

As you see we can check registered flag to only register the first time. All first time work like initialization of plugin, opening a database connection or similar can be done there.

To have code cleanup when the helper quits you can put in a property referencing a class and put cleanup in destructor there. e.g. you can have a tempFile class, with a property for the FolderItem and delete the file in the destructor.

20 07 21 - 14:36