Book a Demo

Author Topic: API autostart  (Read 5387 times)

msdb

  • EA Novice
  • *
  • Posts: 10
  • Karma: +1/-0
    • View Profile
API autostart
« on: May 27, 2016, 06:15:31 pm »
Hi

In my c# project im accessing EA with

Code: [Select]
App eaApp = (App)System.Runtime.InteropServices.Marshal.GetActiveObject("EA.App");

but it requires EA to be running. Is there a way to open EA automatically via code?

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: API autostart
« Reply #1 on: May 27, 2016, 06:28:58 pm »
Yes there is, and there's actually a code sample for it in the help.

Instead of fetching an EA.App from the Windows runtime, create an EA.Repository and call Repository.OpenFile() or Repository.OpenFile2() if you've got user security enabled.

/Uffe
My theories are always correct, just apply them to the right reality.

msdb

  • EA Novice
  • *
  • Posts: 10
  • Karma: +1/-0
    • View Profile
Re: API autostart
« Reply #2 on: May 27, 2016, 06:47:24 pm »
Ah, right. Now I get it. Thank you.