How to run code when dynamo is still starting

Hey guys,

I need to know how to call some code when Dynamo is still starting.

I have done this in grasshopper (similar to dynamo) like this:

  public override GH_LoadingInstruction PriorityLoad()
  {
     Grasshopper.Instances.DocumentServer.DocumentAdded += DocumentAdded;

     var directoryToCopyUpdates = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +
                                  @"\AppData\Roaming\Grasshopper\Libraries\SwecoGrasshopperLibrariesCopier_TS2017i.exe";
     Process.Start(directoryToCopyUpdates);

     return GH_LoadingInstruction.Proceed;
  }

The trick here was that if any package contains a overwrite of PriorityLoad function that is called before grasshopper starts.

Hi @Ricardo.Farinha

You can do this via writing an extension. It’s relatively easy and you can find info about how here…

http://dynamobim.org/extensions-workshop-materials-now-available/

Hope this helps,

Cheers,
Dan

1 Like