Page 1 of 1

Running a script when OXT install process

PostPosted: Mon Aug 06, 2018 5:58 pm
by Mr.Dandy
Hello,

I try to build an OXT which copy some files into a specific folder.
I don't see any events like OnInstall to do it.

Re: Running a script when OXT install process

PostPosted: Sun Aug 12, 2018 8:58 am
by Zizi64
I don't see any events like OnInstall to do it.

Why you need it?

Re: Running a script when OXT install process

PostPosted: Mon Aug 13, 2018 2:33 pm
by Mr.Dandy
My extension runs an external program to be work.
This one must installed in a specific directory.

Re: Running a script when OXT install process

PostPosted: Mon Aug 13, 2018 2:43 pm
by RoryOF
You may already know this, but there is extension configuration information here
https://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extension_Manager
and in the links on its sidebar.

Re: Running a script when OXT install process

PostPosted: Mon Aug 13, 2018 3:17 pm
by RoryOF
Do the files have to be transferred on installation of the extension, or would it be sufficient that they were available when the extension is run?

In that case, start the macro Main with a call to a subroutine to transfer the files. Surround that subroutine call with a conditional, which indicates that the subroutine has been called already on this execution of OO. To do a similar task I use
Code: Select all   Expand viewCollapse view
Global Run as Boolean

Sub Main

   IF not(Run) Then
   Code to do whatever I need to do
   Run = True   ' Set flag to indicate that this macro has been run in this editing session
   End If

other code for main

End Sub 'Main


Re: Running a script when OXT install process

PostPosted: Mon Aug 13, 2018 3:28 pm
by Mr.Dandy
OK I was think that a mechanism existed to make this process automatically.
I was wrong, never mind.
I take your idea to push my files through a macro but if I uninstall my OXT, these don't removed.

Re: Running a script when OXT install process

PostPosted: Mon Aug 13, 2018 3:34 pm
by RoryOF
There may be an installation subroutine to do this or the possibility of entering code to do so in an installation routine, but I have never needed to do this and haven't looked. Have you checked Pitonyak?

Re: Running a script when OXT install process

PostPosted: Mon Aug 13, 2018 3:43 pm
by Mr.Dandy
RoryOF wrote:Have you checked Pitonyak?

Not again but there are a lot of documents and not enough time to looking for. :ouch:

Re: Running a script when OXT install process

PostPosted: Mon Aug 13, 2018 3:47 pm
by RoryOF
In Extension Layers
the section "Code execution during installation" mentions the possibility of running code during an extension. It appears that such code may be platform dependent.

My suggestion is that you should look for some existing extension that requires an external file(s) and modify its installation section.

Re: Running a script when OXT install process

PostPosted: Fri Aug 17, 2018 3:03 pm
by Mr.Dandy
RoryOF wrote: look for some existing extension that requires an external file(s) and modify its installation section.

Right
If someone has this kind of extension, let me know.