Easy DOORS extension

Hey guys, I came across something I like to share with you, which makes it incredibly easy to extend DXL. Ever thought about making a COM Server for some functionality, but considered it to complex? Or you were looking for some complex functionality that is just missing in DOORS...

Well now maybe "Windows Scripting Components" come to your rescue. A Scripting Component is an Active X Component (=COM Server) that can be created in a very easy way by Windows On Board Means. It allows you to write Javascript or VBScript functions and easily make them available in a COM server.

Lets have a look at a simple example:

<?xml version="1.0"?>
<component>
   <registration description="Easy" progid="MyFirst.WSC" version="1.00"
    classid="{74bb1ba9-2e69-4ad6-b02c-c52f3cbe153b}"/>
 
    <public> 
        <method name="SayHello"/>
    </public>
 
    <script language="VBScript">
       sub SayHello() 
          MsgBox "Hello"
       end sub
    </script>
</component>

 

Save this to a 'wsc' file e.g. SayHello.wsc, right click on it and choose "Register" (you need the right to register COM servers on your windows). Afterwards execute the following DXL code:

 

OleAutoObj o = oleCreateAutoObject "MyFirst.WSC"
if (null o) error "Please register the MyFirst.WSC library first"
oleMethod (o, "SayHello")



You should get the MsgBox ... Cool,lets try something less complex. The windows scripting host support Javascript too. And there is an incredibly large javascript library out there! Lets for example take the SHA library that is attached. Store it to a directory and create a WSC file for it:

 

<?xml version="1.0"?>
<component>
   <registration description="Easy" progid="SHATest.WSC" version="1.00"
    classid="{F21A632A-F422-42D8-A586-90E2D4D5AFF9}"/>
 
    <public> 
        <method name="sha256_digest"/>
    </public>
 
    <script language="JScript" src="sha256.js"/>
</component>



Register it, like in the previous step. Now execute the following DXL:

 

OleAutoObj o = oleCreateAutoObject "SHATest.WSC"
if (null o) error "Please register the SHATest.WSC library first"
OleAutoArgs args = create() 
put (args, "IT-QBase")
string result = ""
if (null oleMethod (o, "sha256_digest", args, result)) {
  print "Success: " result "\n"
} else { 
  print "Fail ..."
}



Congratulations, you implemented an SHA hash algorithm for DXL. Now where did I get that class IDs from? These so called GUID (General Universal Identifier) is a random value, that is pretty probable to be unique in the universe (So please create your OWN GUIDs when you start doing COM Servers. Isn't it a good feeling to have something unique?) You can create it for example with the DXL posted here:

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14440671&#14440671

Hope that will help someone. Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 


Mathias Mamsch - Thu Mar 29 03:28:30 EDT 2012

Re: Easy DOORS extension
GerhardS - Thu Mar 29 05:18:08 EDT 2012

Hi Matthias,

great idea, offering nice possibilities. Always fun to read your postings ;-)

We ourselves worked out a Visual C# proof-of-concept to combine a "real" GUI with DXL backend processing. This also allows for a pretty easy and performant enhancement of functionality, especially regarding usability.

Regards,
Gerhard
---
innoreq GmbH
Einfach Prozesse verbessern.

Re: Easy DOORS extension
adevicq - Thu Mar 29 05:42:24 EDT 2012

Thank you very much. This could be very useful (for example to create connectors with other applications).
Yo can use this URL http://www.guidgenerator.com/online-guid-generator.aspx to generate GUIDs.

Regards,
Alain

Re: Easy DOORS extension
SystemAdmin - Fri Mar 30 09:26:18 EDT 2012

Thanks for sharing that Mathias. I'm gonna have aplay with it. I,m sure it will be very useful

Re: Easy DOORS extension
faisal.zahidi@boeing.com - Thu Sep 18 19:33:55 EDT 2014

If I try to register the file per your instruction, the following error is generated.

"The module "C:\Windows\system32\scrobj.dll" was loaded but the call to  DllInstall failed with error code 0x80004005."

I also have tried to register from the command prompt and got the same message:

c:\Windows\system32>

regsvr32 c:\Users\n1126485\Desktop\MyFirst1.wsc  %SystemRoot%\system32\scrobj.dll

 

Got the same error message.

 

Any suggestion is appreciated!

 

thanks

FZ

Re: Easy DOORS extension
Wolfgang Uhr - Sat Sep 20 00:55:51 EDT 2014

Hello Mathias

It's a very interesting idea, but you should know that the registration only works if you have local admin priviledges, which not all users in large firms have. So it is allways a solution for yourself, but never a solution for everyone else.

But running the java-script using wscript will do the same for everyone.

Best regards
Wolfgang
 

Re: Easy DOORS extension
Wolfgang Uhr - Sat Sep 20 00:57:57 EDT 2014

faisal.zahidi@boeing.com - Thu Sep 18 19:33:55 EDT 2014

If I try to register the file per your instruction, the following error is generated.

"The module "C:\Windows\system32\scrobj.dll" was loaded but the call to  DllInstall failed with error code 0x80004005."

I also have tried to register from the command prompt and got the same message:

c:\Windows\system32>

regsvr32 c:\Users\n1126485\Desktop\MyFirst1.wsc  %SystemRoot%\system32\scrobj.dll

 

Got the same error message.

 

Any suggestion is appreciated!

 

thanks

FZ

The best is to goole for the error number. It seems that on your computer not all services are running, which are required for the job.

Re: Easy DOORS extension
Mathias Mamsch - Sun Sep 21 13:32:26 EDT 2014

Wolfgang Uhr - Sat Sep 20 00:55:51 EDT 2014

Hello Mathias

It's a very interesting idea, but you should know that the registration only works if you have local admin priviledges, which not all users in large firms have. So it is allways a solution for yourself, but never a solution for everyone else.

But running the java-script using wscript will do the same for everyone.

Best regards
Wolfgang
 

Hi Wolfgang, as far as I know it is somehow possible to register a DLL for one user only, although that is not the point of this post. It is a general problem of ALL 3rd party COM servers (whether or not they were created with Windows Scripting Components). I guess this technique is most applicable to 3rd party venors, that have the possibility to bundle an installer with their plugins. Software deployment is general problem of any ecorporate infrastructure and it should be expected. that companies IT allows users to install the software necessary for their work. At my company for example people you can get temporary admin rights to be able to install software.

Anyway, calling external programs (e.g. call wscript) is possible. The advantage of this approach is, that it is fast and you do not need to solve the problem of serializing your data to the external library. For this you need to solve the deployment. An external process (wscript) does not need deployment, but has much more overhead for each function call.

Regards, Mathias

 

 

Re: Easy DOORS extension
Wolfgang Uhr - Mon Sep 22 02:23:05 EDT 2014

Mathias Mamsch - Sun Sep 21 13:32:26 EDT 2014

Hi Wolfgang, as far as I know it is somehow possible to register a DLL for one user only, although that is not the point of this post. It is a general problem of ALL 3rd party COM servers (whether or not they were created with Windows Scripting Components). I guess this technique is most applicable to 3rd party venors, that have the possibility to bundle an installer with their plugins. Software deployment is general problem of any ecorporate infrastructure and it should be expected. that companies IT allows users to install the software necessary for their work. At my company for example people you can get temporary admin rights to be able to install software.

Anyway, calling external programs (e.g. call wscript) is possible. The advantage of this approach is, that it is fast and you do not need to solve the problem of serializing your data to the external library. For this you need to solve the deployment. An external process (wscript) does not need deployment, but has much more overhead for each function call.

Regards, Mathias

 

 

Hello Mathias

As far as I know, you can register a com server in HKEY_LOCAL_MACHINE, then the server is accessible by all users or you can register it in HKEY_USERS, the it is only avaliable for one user. But in both cases you need local admin priviledges.

And of course, technically seen, there is nothing simpler than the registration of a com server in an installation process. But I'm working for an employee, who has contracted more 150.000 members and that means that there is a special department for everything elsewhere. In this case even the smallest installation script is a real project. And that is valid for the script and for any future changes.


And the serializing problem you only can avoid in this case. For example see the FilesystemObject, which is allready installed at any PC.

Here an example: http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/disk/drives/#EnumDiskDrive.htm

Let us take the example "FreeSpace" of a volume. On com-Server-Site you have the variable type Variant, which means that the script interpreter itself decides the type of the variable which is used. FreeSpace is of type Longint. In doors dxl you do not have Longint, you only have Integer. I've tested this routine on my volume C:. Windows tells me, that the free space is about ~84,5 GB. FSO inside of dxl tells me, that the free space is about ~-2,1 GB.

And if I change from

int iReturn;
oleGet(driveObj, "FreeSpace", iReturn)

to

string sReturn;
oleGet(driveObj, "FreeSpace", sReturn)

then I gent an empty string for the solution


And furthermore the change to

real rReturn;
oleGet(driveObj, "FreeSpace", rReturn)


is not possible, because dxl-oleGet-routine supports string, int, bool, char and oleAutoObj as a result type but not real.

Only sometimes - then you are very lucky - you can avoid serializing.

Best regards
Wolfgang