Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trigger a macro at startup

Occasional Contributor

Trigger a macro at startup

How can I trigger a macro to run at startup of MEGA?

2 Replies

Re: Trigger a macro at startup

Hello RamiGh


There is no standard feature for this


It is common to configure a MetaCommand for MetaClass 'Repository'. The associated macro implements CmdCheck and/or CmdInit. This macro is triggered on most situations when click on the menu 'File' in Windows Front-End


Note that this code is not fully reliable. It cannot be assumed that the macro is triggered each time a private workspace is initialized.


Re: Trigger a macro at startup



There is a way that works for me and that you could try : explore the "Repository" metaclass, and "Right clic > New" on the "Commands" folder.

Choose "MetaCommand Manager". (name it "atMegaStart" for example)

In the properties of this new metaCommand, go in the "Setup" tab and create a new macro (that you can also name "atMegaStart".

In this macro, create your sub (and guess what... you can name it "atMegaStart"... 🙂 and call it :

Sub atMegaStart()
  <your code to do whatever you want at startup>
End Sub

atMegaStart 'call your sub

Exit MEGA (dispatch your update), and translate/compile your metamodel.


Your macro should now be trigered at startup.






PS : this is for an Hopex version. For a 2009 version, just right click on the "MetaCommand" folder when you explore your "Repository" metaclass, and create a new one (no disctinction between metacommand Item & metacommand manager). Then create your macro the same way as for MEGA Hopex.