This is a general question about DXL triggers. How can I ensure that the first time a module is opened, the following trigger is created? trigger("My Module Open", project->module->formal, post, open, 10, "#include <addins/Trigopen/Trigopen.dxl>") I am able to create the trigger by putting the code in a dialog box script. But I can't rely on the user to open the dialog box from the menu.
Thanks John JohnThorpe - Sun Feb 02 13:52:05 EST 2014 |
Re: Where to store script to create persistent open module post trigger It seems to me, that if you store a trigger with project wide scope, then there is no need to install the trigger on each module. The trigger will be executed on the opening of any module anyway, why would you want to install the trigger separately for each module? Regards, Mathias |
Re: Where to store script to create persistent open module post trigger Mathias Mamsch - Mon Feb 03 09:20:25 EST 2014 It seems to me, that if you store a trigger with project wide scope, then there is no need to install the trigger on each module. The trigger will be executed on the opening of any module anyway, why would you want to install the trigger separately for each module? Regards, Mathias Mathias, thanks for the speedy response. How would I get this out to users then? Should I run the trigger script at the database level on just my machine?: <code> Trigger t bool tExist = false for t in database do { if(name(t) == "My Module Open") tExist = true } if(tExist == false) trigger("My Module Open", project->module->formal, post, open, 10, "#include <addins/Trigopen/Trigopen.dxl>") </code>
Thanks John |
Re: Where to store script to create persistent open module post trigger
If you need to run a script on all your modules, triggers are not the good mecanism ;) Have you tried it ?? |
Re: Where to store script to create persistent open module post trigger pommCannelle - Mon Feb 03 11:33:53 EST 2014
If you need to run a script on all your modules, triggers are not the good mecanism ;) Have you tried it ?? I haven't tried that method, but thanks for the idea. John |
Re: Where to store script to create persistent open module post trigger Mathias Mamsch - Mon Feb 03 09:20:25 EST 2014 It seems to me, that if you store a trigger with project wide scope, then there is no need to install the trigger on each module. The trigger will be executed on the opening of any module anyway, why would you want to install the trigger separately for each module? Regards, Mathias Mathias, You're correct, I only need to install it at the project level. Forgive my ignorance, but I'm not sure of the mechanism that will install the trigger for all users and projects. The trigger creation code doesn't get executed when I put it in the addins folder. Is there some other location that will install the trigger?
Thanks John |
Re: Where to store script to create persistent open module post trigger Hi John, well first of all, if you want a DXL script to be accessible you need to deploy it in a way, so that it is available to anyone with a DOORS client. There are a couple of possibilities: 1. Inside the Trigger. Note that the trigger creation code has a DXL statement inside: "#include <addins/Trigopen/Trigopen.dxl>". So you do not specify a file but DXL code to be executed. That means, you can put the complete source code into the trigger, but of course you must not have any include dependencies inside the Trigopen.dxl. 2. On a globally accessible network share You can put an absolute include from a network address like #include <\\server\share\folder\script.inc> inside the code (be careful, when putting those backslashes to a string). This is normally a very easy way to deploy DXL scripts, but be aware that relative includes inside the file are only resolved correctly when the path is inside the addins / projectaddins / layoutaddins environment ... 3. With the DOORS client Depending on your software deployment strategy it might be possible for your IT department to provide certain files to all computers with installed DOORS clients. In this case you can copy the files to the local addins directory. 4. DXL Deployment Another possibility is a DXL script that will copy the file to a location on the users computer e.g. "%USERPROFILE%\DXL\addins" or maybe you can find a fixed path (because otherwise including it can be harder). Then you can include the files from here. Regarding Triggers It seems to me you might not have enough "Trigger-Fu" (trigger experience) yet to develop triggers for a production system. So make sure you re-read the trigger documentation and have a test system ready for testing developed trigger code (do that extensively). Deploying project or even database wide triggers by accident in a production system will make the mob come after you (if on opening of every module a couple of DXL popup errors annoy ALL users and prevent all scripts from running through). And of course: Please evaluate if triggers are really what you want ;-) Just my two cents, regards, Mathias |
Re: Where to store script to create persistent open module post trigger This may repeat parts of other responses. Re-read MM's "Trigger-Fu" sentance. OK. Persistent trigger code has two parts
I note your trigger "level" is at the "Project", which means your trigger will be stored in the current Project ... so navigate to the project then run the deploy code. Any module opened in the Project is a qualifying "event".
There is indeed a problem of where to put that code so all that it gets executed by all users who initiate the event. For simple scripts (that do not need any #include statements), your Deploy code could (in addition to what MM said) read a file and deploy THAT code directly into the trigger. Then only the person deploying the code needs access to it.
I think the template for DeployCode could look like this
-Louie |