Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Paulus

Pages: 1 ... 5 6 [7] 8 9 ... 11
91
Hi Sven,

I know this was answered some time ago, somewhere on this forum, bu i can't find it.

Anyways, you can use the GUID generated by the script below,

regards,

Paulus

Code: [Select]
Dim typeLib
typeLib = CreateObject("Scriptlet.TypeLib")

' GUIDs returned from typeLib have 2 unprintable characters at the end. Strip them off.
GenerateGUID = Left(typeLib.Guid, 38)

92
Automation Interface, Add-Ins and Tools / Re: Deep Delete element
« on: January 09, 2013, 05:05:19 am »
Hi SvenK,

I wasn't referring to the 2nd argument in 'DeleteAt' but to the return value of the event 'EA_OnPreDeleteDiagramObject'.

You need to pass FALSE to stop EA from deleting the object as well if your code handles the deletion.

Effectively this is (mis)using an event intended to -prevent- the deletion of an ob ject to actually -handle- the deletion ourselves... but it works.

grts,

Paulus

93
Automation Interface, Add-Ins and Tools / Re: Deep Delete element
« on: December 12, 2012, 07:13:34 pm »
Exactly what i'm using it!  :)

But be aware: inexperienced users or others not using your add-in -may- re-use an element in other diagrams anyway (you can always drag it to another diagram from the project explorer).

So be sure to check if the element is used exclusively by a diagram before deleting it.

grts,

Paulus

94
Automation Interface, Add-Ins and Tools / Re: Deep Delete element
« on: December 12, 2012, 10:02:43 am »
Hi Simon,

You are of course absolutely right that you need to understand the consequences of what you are doing before scripting something like this and that there aretrade-offs to be considered.

But in as far as  end-users are concerned i think it is not unreasonable to ask for an automatic removal of a model element that (from a user perspective) belongs to only that specific diagram.

For the record the actual script i use includes a 'sanity check' on the element prior to the call to the delete script i provided: only elements that an end-user would consider to be private to the diagram (eg activityinitial, action, ...) are eligible  for removal from the model as well, and even then they are only removed if the element actually is an orphan from the model point of view.

To me preventing cluttering of the model with orphaned elements outweighs the disadvantage of not being able to undo the delete of elements if they can easily be re-introduced.

So no i don't consider this a bad idea at all, as long as you think it through. You mention that there may be additional advantages, could you clarify on that? So far i haven't encountered any. Can it be that the internals of EA may hold a surprise for me?

best regards,

Paulus

95
Automation Interface, Add-Ins and Tools / Re: Deep Delete element
« on: December 11, 2012, 08:29:01 pm »
ur welcome!

Btw i made a mistake, you should pass FALSE to EA to prevent deletion. Update the previous post for future reference

96
Automation Interface, Add-Ins and Tools / Re: Deep Delete element
« on: December 11, 2012, 06:11:48 pm »
When you delete a diagram object the event 'EA_OnPreDeleteDiagramObject' fires passing the ID of the element that the diagramobject links to.

First check if you want to delete the element from the model behind the diagramobject, and if so delete it from the model and pass 'truefalse' to EA to prevent EA from trying to delete the (at that time already deleted) diagramobject.

Here's some (vbscript) code that deletes an element (and consequently, its associated diagramobjects) from the model:

Code: [Select]
sub DeleteElementFromModel(elt)            
      dim elements, i
      if elt.ParentID = 0 then
            set elements = GetPackageByID(elt.PackageID).elements
      else
            set elements = GetElementByID(elt.ParentID).elements
      end if

      for i = 0 to elements.Count - 1
            if elements.GetAt(i).ElementID = elt.ElementID then
                  elements.DeleteAt i, false
                  Elements.Refresh()
                  exit sub
            end if
      next
end sub

best regards,

Paulus

97
I thought this would be as simple as replacing HKCU with HKCR in the Wix snippet below but that didn't work.

Is it possible to install an add-in on a computer making it available to anyone who uses EA on that computer?

Code: [Select]
<Component Id="EAScriptingToolsRegEntries" Guid="8E98D5E2-5DC9-4A53-ADC0-021CA6D8E273">
      <RegistryKey Root="[highlight]HKCU[/highlight]" Key="Software\Sparx Systems\EAAddins\EAScriptingTools" Action="createAndRemoveOnUninstall">
            <RegistryValue Type="string" Value="EAScriptingTools.EventDelegator" />
      </RegistryKey>
</Component>


98
Automation Interface, Add-Ins and Tools / Quicklinker not working?!
« on: December 13, 2012, 05:21:22 am »
Hi all,

Some time ago the quicklinker definition in my MDG technology stopped working, but -only on my development & test configurations-. On other machines the QL works.

I am at a loss what could be the cause. I went as far as completely uninstalling EA and re-installing but without effect. Creating the MDG technology on another machine produced a working QL but again, not on -dev/test-.

Obviously i must have changed something on my dev/test machines but i can't figure outy what... has anybody come across similar problems before? I noticed that uninstalling EA does not seem to remove a number of registry settings. Could this be the cause of the problem?

reg,

Paulus

99
Automation Interface, Add-Ins and Tools / Re: Add-in configuration how ?
« on: December 13, 2012, 04:45:10 am »
Hi Danny,

Also worthwile to consider: use the EA repository itself to store configurations in a private (user) package.

Let your add-in check for a named model element '<youraddin>Config' of eg type class in some private 'workspace' package of the logged in user. You then could add to that element an attribute for each configuration property your add-in requires, setting the initial value of the attribute to the value of the property for that user.

Each user can configure the settings as they like.

To locate the private package you could use the name of the current user: first try Repository.GetCurrentLoginUser and if that throws an exeception (no EA security installed) use the WindowsIdentity of the current user as an alternative. I use this method to create a private workspace for each user in the repository in a root model 'Workspaces'. One step further: if the current user has no private package (new user), create one and create a default configuration in it.

Note:
- that the configurations are only known once the repository is opened. This can be a drawback or an advantage, depending on your needs.
- a user has to check out the private package to prevent others from changeing settings (but that's common sense when using a private workspace i think). I suppose the add-in could do that as well when creating the package the very first time.
 
best regards,

Paulus

100
I guess its empty because you created a new instance of EA and haven't told EA which repository to open.

If EA is already running and connected to the repository, use GetObject("EA.App") to obtain a reference to it.

best regards,

Paulus

101
I agree with Geert, but if you want to give it a try: i created an SQL some time ago that does something similar: it determines text elements contained within a boundary element 'Toelichting' on a diagram.

That should get you started.

Here's the SQL string (in vbscript):

Code: [Select]
Dim RTFGEN_SQL_DGM_REMARKSFORDGM: RTFGEN_SQL_DGM_REMARKSFORDGM = _
" select tlo.Note as REMARK" &_
" from t_diagram d" &_
"            ,t_diagramobjects do" &_
"            ,t_object o" &_
"            ,t_diagramobjects tl" &_
"            ,t_object tlo" &_
" where  tlo.object_id = tl.Object_ID" &_
"            and tl.diagram_id = d.diagram_id" &_
"            and o.object_id = do.object_id" &_
"            and do.diagram_id = d.diagram_id" &_
"            and o.Name = 'Toelichting' and o.object_type = 'Boundary'" &_
"            and tlo.object_type in ('Note','Text')" &_
"            and tl.RectTop <= do.RectTop " &_
"            and tl.RectLeft >= do.RectLeft" &_
"            and tl.RectRight <= do.RectRight" &_
"            and tl.RectBottom >= do.RectBottom" &_
"            and d.ea_guid = '{0}'"

102
I'm sorry, but i can't help you with that. I'm using VS 2010 as well and i had some startup problems with DLL's but not something like this. :-/

103
Maybe i misunderstand but my point is that you now have a simple testcase reproducing the error that doesn't require knowledge of EA to solve, just VS, COM and VBA.

So if you can't get an answer here (and this seems to be the case) there are plenty, and probably better, places where you can. Eventually your search might lead you back to EA  but for now that's not the case.

I suggested the brute-force method since that's what i usually do if i'm stuck like this.

best regards,

Paulus

104
... so that tells you the current problem is not related to EA but the deployment of the DLL itself.

Brute force: start with a version of your add-in with no dependencies (comment the code) and call again from VBA. If that works, start adding code/dependencies until the problem reappears. Then check the offending dependency. Note that even if the registry looks OK it may be incorrectly installed or be corrupt.

Paulus

105
... or perhaps your add-in is using other resources that are missing, things like .net framework, or certain ocx-es or 3d part dlls?  .... or ...: like Geert said, if you haven't got a clue use another method to access your add-in dll to rule out any issues that are not ea-related.

If Excel is not available on all workstations write a small vbscript in EA that uses createobject to load your assembly and run some method in it. If you have tested that in EA, run the script on other workstations in WSH or whatever scripting engine is available and check the err object for clues,

Paulus

Pages: 1 ... 5 6 [7] 8 9 ... 11