Book a Demo

Author Topic: Run script from add-in  (Read 7592 times)

janos_murai

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Run script from add-in
« on: June 23, 2016, 05:52:05 pm »
Dear all,

I have a C# add-in and a VBScript. Is it possible to include and start the script from the add-in?
I know that with the
Code: [Select]
!INC Local directive I can include scripts into each other, but how does it work with external sources?

Thank you!

Janos Murai

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Run script from add-in
« Reply #1 on: June 23, 2016, 06:28:51 pm »
Hi,

Not a direct answer to your question but have a look at Geerts site - there are details here (plus an add-id) about how to run scripts from add-ins etc...

https://bellekens.com/

Regards,

Jon.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Run script from add-in
« Reply #2 on: June 23, 2016, 08:33:11 pm »
Thanks Jon,

It's actually the (free and open source) EA-Matic add-in that executes scripts.
You can find the code for it here: https://github.com/GeertBellekens/Enterprise-Architect-Toolpack/tree/master/EAScriptAddin

If you consider using my framework you better also read this: How to Use the Enterprise Architect Add-in Framework

Geert

janos_murai

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Run script from add-in
« Reply #3 on: June 23, 2016, 09:03:29 pm »
Thank you Jon and Geert!

Geert, your website is really nice and helpful!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Run script from add-in
« Reply #4 on: June 23, 2016, 10:04:00 pm »
Thank you Jon and Geert!

Geert, your website is really nice and helpful!

Thanks, appreciate it :)

Geert

janos_murai

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Run script from add-in
« Reply #5 on: June 29, 2016, 05:06:21 pm »
I have a new problem, which is relevant to the original topic.

I could create an add-in using the Enterprise Architect Add-in Framework. The script calling works the same way as in EA-matic.
The problem is with the EA object. If I create a new variable in the script like
Code: [Select]
dim selectedPackage as EA.Package and I run it from EA, it runs without error, but if I run the same script via my add-in (so the interpreter is called by the add-in), it throws the following error:
"Anweisungsende erwartet ERROR : Anweisungsende erwartet | Line of error: 398 | Code error: \tdim selectedPackage as EA.Package"
I tried it with EA-matic's source in debug mode, and I experienced the same behavior.
Any idea what could cause this problem?

Thank you!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Run script from add-in
« Reply #6 on: June 29, 2016, 05:51:37 pm »
Hi Janos,

You can't use "as EA.Package" or any "as..." in EA-Matic scripts

These are EA specific extensions that are nor recognized by the native script controller.

I was planning one day to strip all of those from the scripts before adding them to the script engine, but I haven't found the time yet.
I'm sure EA strips these as well in the background.

Geert