Book a Demo

Author Topic: Open Diagram directly from the desktop  (Read 7079 times)

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Open Diagram directly from the desktop
« on: September 15, 2005, 09:44:07 am »
Hi Everybody,

our trainee wrote two little VB applications.

The first one wrote the current project and the current Diagram ID to a file with the extension "EAD" (EA Diagram)

The second application was associated with this file extension. When you double click this EAD file, the socond application reads this file, open the project (if it's not allready open) and loads the diagram stored in the file.

With this two little tools it was possible for us to store "Diaglram Links" on the desktop (or anywhere on the harddrive) and open the diagram directly with a double click.

I hope this explanation is good enough that everybody understand what this tools made.

This solution works perfect for us ... till last week!

But now, we've moved our EAP file to a MSSQL Repository, the tools didn't work and the trainee is gone  :-/

Now it's my job to change the tools to the new requirements with my minimum knowledge about VB and the autoation interface.  ???

In the past we opened EA and load the project with the following code:

Code: [Select]

deskWin = GetDesktopWindow()
ShellExecute(deskWin, "Open", projectPath, "", "", 1)

This works fine for EAP files, but for sure not for Repositorys in a DB.  :(

How can I identify the currently loaded repository
and
how can I load the repository with the automation interface.

I'm happy about evry kind of help! :-*
bye
Andreas

thomaskilian

  • Guest
Re: Open Diagram directly from the desktop
« Reply #1 on: September 15, 2005, 09:47:46 am »
GetDesktopWindow() and ShellExecute() are both methods of your own. EA can be opened through automation also with SQL Server, but you need to look into the mentioned procedures.

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: Open Diagram directly from the desktop
« Reply #2 on: September 15, 2005, 10:08:29 am »
Hi Thomas,

I think you sit all the time in front of your screen and visit for new messages. It takes not even five minutes till I got your answer! That's cool!  8)

But back to the topic:

Quote
GetDesktopWindow() and ShellExecute() are both methods of your own. EA can be opened through automation also with SQL Server, but you need to look into the mentioned procedures.

GetDesktopWindow() and ShellExecute() are methods from VB (I think this is what you realy mean with "methods of your own").

But what do you mean with mentioned procedures?
Are you talking about LoadProject()? Is it possible to give here also the db-string?

bye
Andreas

« Last Edit: September 15, 2005, 10:10:01 am by glaubitz »
bye
Andreas

thomaskilian

  • Guest
Re: Open Diagram directly from the desktop
« Reply #3 on: September 15, 2005, 10:33:08 am »
What about you. Shouldn't you be at home with your family right now ;)

I'll try to work out an example on how to open EA from a repository tomorrow. I have to leave now...

thomaskilian

  • Guest
Re: Open Diagram directly from the desktop
« Reply #4 on: September 15, 2005, 01:58:15 pm »
I have to retreat from my previous answer. I tried to open EA using OpenFile and OpenFile2 but none lets me connect to a server repository. I tried via ODBC but I had no luck too. Sparx?
« Last Edit: September 16, 2005, 12:00:56 am by thomaskilian »

thomaskilian

  • Guest
Re: Open Diagram directly from the desktop
« Reply #5 on: September 19, 2005, 04:23:05 am »
This one kept me busy. I thought having tried this and it did not work: http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=Automation;action=display;num=1108078409
Probably I'll have to try again :P

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: Open Diagram directly from the desktop
« Reply #6 on: September 19, 2005, 09:15:23 am »
Hi Thomas,

in my case it works now!
I use EA.Project.LoadProject() wíth the connection String as Parameter.

Works without problems.  :)

The only Problem I have is, that EA must be open before I start my script, because GetObject(, "EA.App" will not work if the application is not running allready.

bye
Andreas
bye
Andreas

thomaskilian

  • Guest
Re: Open Diagram directly from the desktop
« Reply #7 on: September 20, 2005, 03:29:31 am »
There should be a CreateObject?

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: Open Diagram directly from the desktop
« Reply #8 on: September 20, 2005, 04:07:20 am »
As I remember a object created by CreateObject will be destroyed after the script is finished.
bye
Andreas

thomaskilian

  • Guest
Re: Open Diagram directly from the desktop
« Reply #9 on: September 20, 2005, 12:03:57 pm »
Or you explicitely wait for the process to finish.
« Last Edit: September 20, 2005, 12:05:01 pm by thomaskilian »

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: Open Diagram directly from the desktop
« Reply #10 on: September 20, 2005, 11:35:01 pm »
I think this is not a nice solution.

At the moment I show a MsgBox "Please start EA" if GetObject() fails ;)
This is good enough for us.
bye
Andreas