Book a Demo

Author Topic: How to run script from diagram?  (Read 11210 times)

survex

  • EA User
  • **
  • Posts: 76
  • Karma: +1/-1
    • View Profile
How to run script from diagram?
« on: November 23, 2014, 08:44:35 pm »
I've made some automation scripts and I want to execute them from diagram. We can add hyperlink element to diagram of type EACommand and set some commands to hyperlink. I'm looking for the ability to execute script from diagram same way. Is it possible?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to run script from diagram?
« Reply #1 on: November 24, 2014, 12:59:36 am »
Drag the scripting editor window from its tab to some other position (an eventually dock it elsewhere). From there you can run the script with a diagram open.

Also you can issue Run Script from the context of the script in the Scripting window.

q.
« Last Edit: November 24, 2014, 01:01:09 am by qwerty »

survex

  • EA User
  • **
  • Posts: 76
  • Karma: +1/-1
    • View Profile
Re: How to run script from diagram?
« Reply #2 on: November 24, 2014, 02:33:06 am »
I think I haven't made my question clear.

I can make working panel on my diagram using:
- Report Specification Artifact
- Hyperlink type: EACommand , GenerateWSDL
etc.

So my diagram is set of "buttons" executing specific tasks.

I want to create "button" which executes some script - I don't want to open Scripting window and stuff like that.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to run script from diagram?
« Reply #3 on: November 24, 2014, 04:35:08 am »
I guess you can't do that. Hyperlink looks like it would be the place to offer such a functionality as there it has bells and whistles for everything - except running a script or calling an add-in. The latter hasn't even made it into the menu bar...

q.

survex

  • EA User
  • **
  • Posts: 76
  • Karma: +1/-1
    • View Profile
Re: How to run script from diagram?
« Reply #4 on: November 24, 2014, 05:58:51 am »
Hm, maybe I will use some dirty hack:
- say I have script [Foo] to execute for current model
- I create proxy diagram script [FooDiagram] for script [Foo]
- I add any diagram hyperlink on my panel (i.e. diagram with "buttons") naming it Foo
- and if I want to run script Foo: Right Click on hyperlink Foo > Script > Foo

Very clumsy I guess, but for me it would be better to have predefined set of actions with comments in one place, then to change window, to search needed script for current model and trying to remember what it is doing.
« Last Edit: November 24, 2014, 06:00:30 am by survex »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to run script from diagram?
« Reply #5 on: November 24, 2014, 07:15:47 am »
You might subscribe an add-in for EA_OnContextItemChanged and see if one of your buttons got clicked.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to run script from diagram?
« Reply #6 on: November 24, 2014, 06:42:40 pm »
I'm working on an add-in to allow scripts to be triggered when EA events happen:
EA Scripting Addin

Would you be interested in something like that?

Geert

survex

  • EA User
  • **
  • Posts: 76
  • Karma: +1/-1
    • View Profile
Re: How to run script from diagram?
« Reply #7 on: November 24, 2014, 10:22:26 pm »
Quote
I'm working on an add-in to allow scripts to be triggered when EA events happen:
EA Scripting Addin

Would you be interested in something like that?

Sure, it would be very convenient!

Stefan Bolleininger

  • EA User
  • **
  • Posts: 308
  • Karma: +0/-0
    • View Profile
Re: How to run script from diagram?
« Reply #8 on: November 24, 2014, 10:34:26 pm »
Hi,

I did some work on the event-based scripting last user group meeting last october.
Maybe you may take the presentation sheets from there.

Regards

Stefan
Enterprise Architect in "safetycritical development" like medical device industry. My free Add-in at my Website

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to run script from diagram?
« Reply #9 on: November 24, 2014, 10:55:39 pm »
Quote
Quote
I'm working on an add-in to allow scripts to be triggered when EA events happen:
EA Scripting Addin

Would you be interested in something like that?

Sure, it would be very convenient!
I'll post here when I have released the first beta version. I'm hoping to release it in the next couple weeks.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to run script from diagram?
« Reply #10 on: November 28, 2014, 06:53:35 pm »
I've just released the first beta version of the add-in.

EAScriptAddin_Setup_v1.0.2.1(BETA).msi

Best to start by creating a new empty script and then start the settings dialog using Extensions|Scripting Addin|Settings

Use the checkbox "Show all operations" to show all possible operations, select the operation and the script and press "add function"

Then you can close the dialog, press the button "refresh script tree" in the scripting window, and start adding functionality.

The operation will be triggered just like it would in a "real" add-in.

Geert

PS. Thanks to Stefan Bolleininger for the initial code and the idea.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to run script from diagram?
« Reply #11 on: December 04, 2014, 06:37:35 pm »
I've published a newer beta version
EAScriptAddin_Setup_v1.0.3.0(BETA).msi
This version supports the "!INC" syntax to include local scripts, and makes it easier to add a new script function (doubleclick or check the checkbox)

Geert