Passing Command Line Parameters to a DXL Script

Hello,

I have a DXL script that is to large to run all at once and needs to be broken up. I'm looking to call something from a windows cmd file which would look like the following...

"C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -batch "D:\DXLScripts\Installed\addins\aessUtil\extractRawData.dxl" -project DDSS -user bart -password 1234 -logfile "C:\extractRawData.log" -debug "moduleName" "outputFile"

...where "moduleName" and "outputFile" can be passed in and used by the DXL script.

Is it possible to do something like this?

JJHN
SystemAdmin - Wed Jul 07 18:09:51 EDT 2010

Re: Passing Command Line Parameters to a DXL Script
Peter_Albert - Thu Jul 08 03:49:13 EDT 2010

I am using the -dxl switch instead of -batch, and in the -dxl parameter am defining global string variables which are then used in the "#include"d script.

If you don't want to see the explorer window, you can add a "hide(dbExplorer)" to the -dxl parameter, or you really start in batch mode by adding "-batch doNothing.dxl", where the respective dxl file is just an empty file.

Regards,

Peter

Re: Passing Command Line Parameters to a DXL Script
SystemAdmin - Thu Jul 08 18:29:53 EDT 2010

Peter_Albert - Thu Jul 08 03:49:13 EDT 2010
I am using the -dxl switch instead of -batch, and in the -dxl parameter am defining global string variables which are then used in the "#include"d script.

If you don't want to see the explorer window, you can add a "hide(dbExplorer)" to the -dxl parameter, or you really start in batch mode by adding "-batch doNothing.dxl", where the respective dxl file is just an empty file.

Regards,

Peter

Hi Peter,

I've tried this a number of different ways and am unable to get it to work. Here is my last attempt.

D:\>"C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -project DDSS -user bart -password 1234 -logfile "C:\extractRawData.log" -debug -dxl string myGlobalVar=testString "D:\DXLScripts\Installed\addins\aessUtil\extractRawData.dxl"

extractRawData.dxl includes file 'commandLineInput.inc' which contains "string commandLine = eval_("myGlobalVar")".

It doesn't like my command line and gives the error '-E- DXL: <Line:1> syntax error'.

Prior to the above attempt I tried this...

D:\>"C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -project DDSS -user bart -password 1234 -logfile "C:\extractRawData.log" -debug -dxl "D:\DXLScripts\Installed\addins\aessUtil\extractRawData.dxl" string myGlobalVar=testString

This gave the errors '-E- DXL: <Line:1> undeclared variable (D)' and '-E- DXL: <Line:1> syntax error'.

Any ideas on what I am doing wrong?

If there is any documentation on how this works please point me that way. It seems this would be something many folks would use on a regular basis.

Thanks,

JJHN

Re: Passing Command Line Parameters to a DXL Script
Peter_Albert - Fri Jul 09 03:33:43 EDT 2010

SystemAdmin - Thu Jul 08 18:29:53 EDT 2010
Hi Peter,

I've tried this a number of different ways and am unable to get it to work. Here is my last attempt.

D:\>"C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -project DDSS -user bart -password 1234 -logfile "C:\extractRawData.log" -debug -dxl string myGlobalVar=testString "D:\DXLScripts\Installed\addins\aessUtil\extractRawData.dxl"

extractRawData.dxl includes file 'commandLineInput.inc' which contains "string commandLine = eval_("myGlobalVar")".

It doesn't like my command line and gives the error '-E- DXL: <Line:1> syntax error'.

Prior to the above attempt I tried this...

D:\>"C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -project DDSS -user bart -password 1234 -logfile "C:\extractRawData.log" -debug -dxl "D:\DXLScripts\Installed\addins\aessUtil\extractRawData.dxl" string myGlobalVar=testString

This gave the errors '-E- DXL: <Line:1> undeclared variable (D)' and '-E- DXL: <Line:1> syntax error'.

Any ideas on what I am doing wrong?

If there is any documentation on how this works please point me that way. It seems this would be something many folks would use on a regular basis.

Thanks,

JJHN

Sorry for being not clear enough:

the -dxl switch expects a string parameter with DXL code as you would write it in the DXL editor, so the following should work as a batch file (.bat):

start "DOORS" "C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -dxl "string myVar=\"hello world\";#include <H:\Desktop\test.dxl>"  -b H:\Desktop\doNothing.dxl -u yourName  -P yourPassword

 


A few things to keep in mind:

in the "raw DXL part" (string myVar = ...) you must escape the " characters (\"hello world\"), and if you want to specify file paths with backslashes, you also have to escape those (i.e. put \\ in the string).

the #included file (test.dxl) in the example can then use the variable defined above

you can define more variables as you like, just put ";" between each element which would be a line of code in the DXL editor

the above example starts DOORS in batch mode, but requires the file "doNothing.dxl" to be available in the specified location (just an empty file)

If you don't want to start in batch mode, because you want to e.g. use a specific view in a module, the .bat file changes to

 

 

 

start "DOORS" "C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -dxl "string myVar=\"hello world\";#include <H:\Desktop\test.dxl>; exit_"  -u yourName  -P yourPassword

 

 

 

 

  • No -b switch
  • An additional ";exit_" in the -dxl parameter


(There is now a dedicated switch available which ends DOORS after execution of the script, it was discussed a while ago in this forum, but "exit_" works as well)

WARNING: I forgot to mention that the second example has one pitfall, which might be a bug: At least in DOORS 8.3, if you use the second example (i.e. open DOORS not in batch mode), and only open Modules in the background (in the #included file) then DOORS falls into an infinite loop! So make sure to always open one module visibly on the screen!

Regards,

Peter

 

 

Re: Passing Command Line Parameters to a DXL Script
SystemAdmin - Fri Jul 09 17:20:10 EDT 2010

Peter_Albert - Fri Jul 09 03:33:43 EDT 2010

Sorry for being not clear enough:

the -dxl switch expects a string parameter with DXL code as you would write it in the DXL editor, so the following should work as a batch file (.bat):

start "DOORS" "C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -dxl "string myVar=\"hello world\";#include <H:\Desktop\test.dxl>"  -b H:\Desktop\doNothing.dxl -u yourName  -P yourPassword

 


A few things to keep in mind:

in the "raw DXL part" (string myVar = ...) you must escape the " characters (\"hello world\"), and if you want to specify file paths with backslashes, you also have to escape those (i.e. put \\ in the string).

the #included file (test.dxl) in the example can then use the variable defined above

you can define more variables as you like, just put ";" between each element which would be a line of code in the DXL editor

the above example starts DOORS in batch mode, but requires the file "doNothing.dxl" to be available in the specified location (just an empty file)

If you don't want to start in batch mode, because you want to e.g. use a specific view in a module, the .bat file changes to

 

 

 

start "DOORS" "C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -dxl "string myVar=\"hello world\";#include <H:\Desktop\test.dxl>; exit_"  -u yourName  -P yourPassword

 

 

 

 

  • No -b switch
  • An additional ";exit_" in the -dxl parameter


(There is now a dedicated switch available which ends DOORS after execution of the script, it was discussed a while ago in this forum, but "exit_" works as well)

WARNING: I forgot to mention that the second example has one pitfall, which might be a bug: At least in DOORS 8.3, if you use the second example (i.e. open DOORS not in batch mode), and only open Modules in the background (in the #included file) then DOORS falls into an infinite loop! So make sure to always open one module visibly on the screen!

Regards,

Peter

 

 

Hi Peter,

This works well. Thanks for your time and efforts.

There is no way I would have figured this out on my own. Did you learn this technique empirically or is there some documentation on it?

Thanks,

JJHN

Re: Passing Command Line Parameters to a DXL Script
llandale - Sun Jul 11 19:29:30 EDT 2010

SystemAdmin - Fri Jul 09 17:20:10 EDT 2010
Hi Peter,

This works well. Thanks for your time and efforts.

There is no way I would have figured this out on my own. Did you learn this technique empirically or is there some documentation on it?

Thanks,

JJHN

The DOORS Help manual says what to do; and in fact the Using Command Line in the DOORS manual is definately clearer than most sections.

But yes, you see, you try, you fiddle, and you figure it out.

  • Louie

Re: Passing Command Line Parameters to a DXL Script
nbernier - Wed Dec 04 18:18:12 EST 2013

Peter_Albert - Fri Jul 09 03:33:43 EDT 2010

Sorry for being not clear enough:

the -dxl switch expects a string parameter with DXL code as you would write it in the DXL editor, so the following should work as a batch file (.bat):

start "DOORS" "C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -dxl "string myVar=\"hello world\";#include <H:\Desktop\test.dxl>"  -b H:\Desktop\doNothing.dxl -u yourName  -P yourPassword

 


A few things to keep in mind:

in the "raw DXL part" (string myVar = ...) you must escape the " characters (\"hello world\"), and if you want to specify file paths with backslashes, you also have to escape those (i.e. put \\ in the string).

the #included file (test.dxl) in the example can then use the variable defined above

you can define more variables as you like, just put ";" between each element which would be a line of code in the DXL editor

the above example starts DOORS in batch mode, but requires the file "doNothing.dxl" to be available in the specified location (just an empty file)

If you don't want to start in batch mode, because you want to e.g. use a specific view in a module, the .bat file changes to

 

 

 

start "DOORS" "C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe" -dxl "string myVar=\"hello world\";#include <H:\Desktop\test.dxl>; exit_"  -u yourName  -P yourPassword

 

 

 

 

  • No -b switch
  • An additional ";exit_" in the -dxl parameter


(There is now a dedicated switch available which ends DOORS after execution of the script, it was discussed a while ago in this forum, but "exit_" works as well)

WARNING: I forgot to mention that the second example has one pitfall, which might be a bug: At least in DOORS 8.3, if you use the second example (i.e. open DOORS not in batch mode), and only open Modules in the background (in the #included file) then DOORS falls into an infinite loop! So make sure to always open one module visibly on the screen!

Regards,

Peter

 

 

I have tryied this with Doors but can't get it to work

 

"c:\Program Files (x86)\IBM\Rational\DOORS\9.3\bin\doors.exe" -u username -P password -dxl "string workingFolder=\"c:\DoorsOut\\\";#include <c:\DEVSeb\RunExtract.dxl>" -b C:\DEVSeb\doNothing.dxl

 

Anybody can see the problem? I also tryed to double backslash the path without any success

Re: Passing Command Line Parameters to a DXL Script
llandale - Thu Dec 05 14:49:05 EST 2013

nbernier - Wed Dec 04 18:18:12 EST 2013

I have tryied this with Doors but can't get it to work

 

"c:\Program Files (x86)\IBM\Rational\DOORS\9.3\bin\doors.exe" -u username -P password -dxl "string workingFolder=\"c:\DoorsOut\\\";#include <c:\DEVSeb\RunExtract.dxl>" -b C:\DEVSeb\doNothing.dxl

 

Anybody can see the problem? I also tryed to double backslash the path without any success

If "can't get it to work" means it runs but does nothing, then I'm guessing that the "batch" script runs first and closes DOORS; denying the "-d" DXL the chance to run.  If so, move the "-d" string over to the "-b" string, and remove the "-d" string.

If it does not run at all, then you got intpret errors.  here is a good sequence:

  • Run DOORS gui
  • Get the code to work in the DXL Window
  • Ignoring stuff in include statements, for every double-quote and every backslash, escape with a backslash.
    • change string workingFolder="c:\DoorsOut\"
    • to    string workingFolder=\"c:\\DoorsOut\\\"     // I note you goofed here; you had c:\Doors...
  • Put that in your -b switch

-Louie

Re: Passing Command Line Parameters to a DXL Script
Peter_Albert - Fri Dec 06 10:46:10 EST 2013

llandale - Thu Dec 05 14:49:05 EST 2013

If "can't get it to work" means it runs but does nothing, then I'm guessing that the "batch" script runs first and closes DOORS; denying the "-d" DXL the chance to run.  If so, move the "-d" string over to the "-b" string, and remove the "-d" string.

If it does not run at all, then you got intpret errors.  here is a good sequence:

  • Run DOORS gui
  • Get the code to work in the DXL Window
  • Ignoring stuff in include statements, for every double-quote and every backslash, escape with a backslash.
    • change string workingFolder="c:\DoorsOut\"
    • to    string workingFolder=\"c:\\DoorsOut\\\"     // I note you goofed here; you had c:\Doors...
  • Put that in your -b switch

-Louie

First of all, Louie is right with the observation that you also have to escape the backslash between "c:" and "DoorsOut", but then there is an interesting secondary problem, where I am inclinded to see a bug

The problem is with the backslash at the end of 'workingFolder'. If you just try:

-dxl "string workingFolder=\"c:\\DoorsOut\\\";print workingFolder"

it throws an error message. Now, if you throw in two more backslashes at the end, then it works as expected:

-dxl "string workingFolder=\"c:\\DoorsOut\\\\\";print workingFolder"

So, you can solve your problem in two ways:

If you can change your c:\DEVSeb\RunExtract.dxl to add the backslash after workingFolder where required, i.e. something like

Stream s = write workingFolder "\\" myLogFile

in the code to make the routine expect the folder without the trailing backslash, then you can go with

-dxl "string workingFolder=\"c:\\DoorsOut\";#include <c:\DEVSeb\RunExtract.dxl>"

i.e. ommit the training backslash; otherwise

-dxl "string workingFolder=\"c:\\DoorsOut\\\\\";#include <c:\DEVSeb\RunExtract.dxl>"

should work as well.

Putting it all into the -b switch does not work, as -b expects just a filename, not DXL.

Regards,

     Peter