Book a Demo

Author Topic: Use EA scripts stored in file outside the model  (Read 6741 times)

Boron

  • EA User
  • **
  • Posts: 111
  • Karma: +6/-0
    • View Profile
Use EA scripts stored in file outside the model
« on: July 30, 2013, 10:06:46 pm »
Hello,

I have a bunch of scripts (JScript) that I use to create some numbers I need for a report on the EA model.
Example: A script that finds all elements in a model with a special tagged value.

As we have many EA models I need to use the same scripts in all models.
I would like to have the script source codes stored outside the models on a network share or a version control repository.
But as far as I can see the scripts have to be stored "inside" the EA model (EA 9.3 menu View -> Scripting).

Is there a way to run scripts that are stored outside EA?
It is really annoying writing /extending/bugfixing a script in one model and deploy it to all other models.

Any idea is welcome.
Except for writing add-ins where we would need something like C# or Visual whatever ;).

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13448
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Use EA scripts stored in file outside the mode
« Reply #1 on: July 30, 2013, 10:12:59 pm »
Boron,

With add-ins you would have to distribute the new version to the different clients iso the different models.

You could of-course write an add-in to automatically update your scripts from a central location once you load a model...

Geert

Boron

  • EA User
  • **
  • Posts: 111
  • Karma: +6/-0
    • View Profile
Re: Use EA scripts stored in file outside the mode
« Reply #2 on: July 30, 2013, 10:30:02 pm »
Your second points sound quite interesting.
So you say it is possible to have an mechanism that can import scripts and update the scripts stored inside the model?

Can you give me some hints or keywords for searching more info on this?
Thanks a lot.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13448
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Use EA scripts stored in file outside the mode
« Reply #3 on: July 30, 2013, 10:45:07 pm »
That shouldn't be too hard no.

You just have to figure out where EA keeps the scripts (I'm guessing t_document ) and then compare the docdate with the modified date of your scrip on the shared drive.

If the docdate < modified date then just update the stringcontent and docdate.

Geert

(PS you can update the database from an add-in (or script) using the ondocumented and unsupported operation Repository.Execute())

Boron

  • EA User
  • **
  • Posts: 111
  • Karma: +6/-0
    • View Profile
Re: Use EA scripts stored in file outside the mode
« Reply #4 on: July 30, 2013, 10:52:13 pm »
Thank you very much :).
This seems to be the way I need to go.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Use EA scripts stored in file outside the mode
« Reply #5 on: July 30, 2013, 10:52:59 pm »
The scripts are in t_script. I'd be careful since EA might have to restart after a silent change. You better have a test before coding.

q.

Boron

  • EA User
  • **
  • Posts: 111
  • Karma: +6/-0
    • View Profile
Re: Use EA scripts stored in file outside the mode
« Reply #6 on: July 30, 2013, 11:08:37 pm »
;) I would never test this on a "productive" model. That is why my local hard disk is filled with eap files for testing "things".
I am not very keen on being killed by my colleagues.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Use EA scripts stored in file outside the mode
« Reply #7 on: July 31, 2013, 01:13:23 am »
I didn't think so :-) But you should test whether EA recognizes a modification of t_script under the hood with a rapid check.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8087
  • Karma: +118/-20
    • View Profile
Re: Use EA scripts stored in file outside the mode
« Reply #8 on: July 31, 2013, 08:39:06 am »
Scripts can be included in an MDG technology, which can then be shared by multiple users for any model they use.

Additionally, scripts can be exported as reference data. You can then configure that file to be automatically imported.