How to use word.dxl script in batch mode?

I am currently writing a C# program to run DOORS in batch mode using the built in word.dxl script.
Below is the following C# code I wrote:

Process doorsExe = new Process();
doorsExe.StartInfo.FileName = "C:\\full path to doors 9.2\\bin\\doors.exe";
doorsExe.StartInfo.Arguments = "-b \"full path to dxl\\standard\\export\\office\\word.dxl" -p \"New Family Car Project\" -u Admin -P password";
doorsExe.StartInfo.UseShellExecute = false;
doorsExe.start();

All of the following code compiles and runs, however a get 13 DXL errors. See the attached screenshot.
This script works fine if I log into DOORS, open a module and use the dxl editor to run the script. How can I use the built in word.dxl script in batch mode? I need to automate exporting a module to Word format in this C# program.
I thank you in advance.
szczy7 - Tue Dec 21 13:49:05 EST 2010

Re: How to use word.dxl script in batch mode?
llandale - Wed Dec 22 01:11:28 EST 2010

First off you must write a script that runs on-demand, that finds and opens a particular named module and uses your word.dxl to export it. Once that works, you should be able to add an 'exit_' to the bottom of it, perhasps "if (batchmode) exit_". I hear rumor that you can get rid of those DXL errors by embracing your entire batch DXL in braces: {} and the first and last characters.

I'd be tempted to write this DXL such that it presumes a particular variable has the name of the module to export, and that variuable name is supplied by your C++ program, perhaps looks like this

-b \"{NameModFull = "/MyProject/MyFolder/MyModule";$include <MyDxl/MyWrittenProgram.dxl>;}"

MyWrittenProgram.dxl may look like this:
Module mod = read(NameModFull, false, true)
if (null mod) halt
current = mod
#include <...word.inc>
close(mod)
if (batchMode) exit_

  • Louie

Re: How to use word.dxl script in batch mode?
szczy7 - Wed Dec 22 11:28:15 EST 2010

llandale - Wed Dec 22 01:11:28 EST 2010
First off you must write a script that runs on-demand, that finds and opens a particular named module and uses your word.dxl to export it. Once that works, you should be able to add an 'exit_' to the bottom of it, perhasps "if (batchmode) exit_". I hear rumor that you can get rid of those DXL errors by embracing your entire batch DXL in braces: {} and the first and last characters.

I'd be tempted to write this DXL such that it presumes a particular variable has the name of the module to export, and that variuable name is supplied by your C++ program, perhaps looks like this

-b \"{NameModFull = "/MyProject/MyFolder/MyModule";$include <MyDxl/MyWrittenProgram.dxl>;}"

MyWrittenProgram.dxl may look like this:
Module mod = read(NameModFull, false, true)
if (null mod) halt
current = mod
#include <...word.inc>
close(mod)
if (batchMode) exit_

  • Louie

Well, now the issue is calling the word.dxl from within my own dxl script. This script traverses a project, no problems with that until I call:

eval_ ("#include <path to dxl\\standard\\export\\office\\word.dxl>);

I have tried the suggested begining { and ending } at the beginning and ending of word.dxl, which resolved 5 errors however I still get 6 errors that reside within the word.dxl. All 6 reside in two files; itfui2.inc and itfui3.inc and I have also tried the {} with those as well resulting in more errors. Please advise.
Thank you in advance.

Re: How to use word.dxl script in batch mode?
llandale - Wed Dec 22 16:14:41 EST 2010

szczy7 - Wed Dec 22 11:28:15 EST 2010
Well, now the issue is calling the word.dxl from within my own dxl script. This script traverses a project, no problems with that until I call:

eval_ ("#include <path to dxl\\standard\\export\\office\\word.dxl>);

I have tried the suggested begining { and ending } at the beginning and ending of word.dxl, which resolved 5 errors however I still get 6 errors that reside within the word.dxl. All 6 reside in two files; itfui2.inc and itfui3.inc and I have also tried the {} with those as well resulting in more errors. Please advise.
Thank you in advance.

using eval_ will lose your context, in this case the current module. Sorry, I've never actually written code to use word.dxl so other's may need to chime in here.

I think your simple script can easily issue the #include statement from the main code context, and therefore should work.

  • Louie

Re: How to use word.dxl script in batch mode?
Mathias Mamsch - Fri Jan 07 17:29:51 EST 2011

szczy7 - Wed Dec 22 11:28:15 EST 2010
Well, now the issue is calling the word.dxl from within my own dxl script. This script traverses a project, no problems with that until I call:

eval_ ("#include <path to dxl\\standard\\export\\office\\word.dxl>);

I have tried the suggested begining { and ending } at the beginning and ending of word.dxl, which resolved 5 errors however I still get 6 errors that reside within the word.dxl. All 6 reside in two files; itfui2.inc and itfui3.inc and I have also tried the {} with those as well resulting in more errors. Please advise.
Thank you in advance.

I tried the following:
 

doors.exe -f %TEMP% -b c:\temp\batch.dxl -u Administrator
 
with
 
// ---------- C:\Temp\batch.dxl ------------
current = read(fullName itemFromID "00006695", true) 
{ #include <standard/export/office/word.dxl> }

 


I think I got the errors you described, which can be resolved by adjusting your batchStartup.dxl (I think Telelogic/IBM did not spend much energy in keeping the batchStartup.dxl up to date), I inserted the following two includes at the end, which are needed by word.dxl (on DOORS 8.2) and are in init.dxl but not in batchStartup.dxl.

 

 

 

#include <utils/tabUtils.inc>
#include <standard/help/codes.inc>



However now I am getting an exception, when I start word.dxl which is good, because it shows that word.dxl is running, but on the other side is expectedly bad, because it will not bring you nearer to your goal. The problem is, that in batch mode, some stuff works differently than in interactive mode. I am only guessing now, but I think you will have problems, since word.dxl tries to export the current view. However I am not exactly sure, which view functions work in batch mode, but I imagine that this will be complicated to solve and will require mayor changes to word.dxl.

So I suggest you to let go of batch mode, start DOORS in interactive mode, but with the -D flag for executing your export script after login. Then let your script end DOORS afterwards, e.g. by calling the exit_ function (You might want to check if that function will give back the client license before terminating DOORS).

I described some ways to "remote control" DXL dialogs in earlier posts, using this technique you will be able to make the settings in the word export dialog and start the export.

Hope that helps, regards, Mathias



 

 

 

 


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