Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: stevesavage on February 03, 2017, 02:35:48 am
-
For one of my scripts I'd love to be able to do the following:
- In the Package Browser, select Package "A"
- View Package "A" as a List (Package List View)
- Navigate to Package "B"
- Select some Elements in Package "B"
- Run my script
- Script uses Repository.GetTreeSelectedElements() to get the Elements I selected in Package "B"
- Script uses "Session.Prompt" to pause and ask me to select items from Package "A"
- I go back to the Package List View from step 2
- I select Elements in the Package List View
- Script uses ????? to get the Elements I selected in the Package List View, fromPackage "A"
I don't think this is supported right now, but I thought I'd ask.
By the way, if you didn't know already, you can open multiple "list views" at the same time, and drag and drop elements between them... handy for organizing things in Sparx EA.
-
The problem is that a script is running exclusively, so you can not pause it fo the user to do selection. The only way that comes to mind is to have two scripts. When time has come for the 2nd selection, the first script saves its context (the simplest would be to use a file here, but the registry or some tricky shared memory technique could be used as well). Now the use can do the selection and continue with the 2nd script reading the context from the saved storage.
q.
-
Hi Query, I've discovered that calling Session.Prompt actually pauses script execution.
I already have a similar script working where I select Diagram Objects
I use that script to select a set of Diagram Objects, then select Elements in the Project Browser, and then the script creates a trace relationships between the Diagram Objects and the Selected Elements. The script creates the a trace relationship in the correct direction based on Element Types + Stereotypes.
I find this quicker than dragging to the diagram, or using a matrix in many cases.
I'd like to do the same between the Package Browser and the Package List View.