Automating my MS Word Export...

We currently have a manual process for generating documents for our customers. We have developed a VBAScript to import three different files, merge them together and generate the documentation we need. These three files are: the contents of the Module in book form, a table view of requirements tracing, and a table of the changes since last we created the document.

These all work well. I am trying to take this to the next level. Currently we manually export these files to run with out script. I would like to have a command line ability to do this.

The problem I am running in to is the MS Word exporter has a UI and I cannot seem to bypass it.

I have looked at DocExpress, but got very lost, very quickly.

Does anyone know where to get a DXL script to export without the dialog? Or a better solution. I plan to embeded the DXL script in the VBScript and run from DOORS cli.

Thanks,

David
David Clark - Wed Oct 14 19:21:07 EDT 2009

Re: Automating my MS Word Export...
kbmurphy - Thu Oct 15 13:06:50 EDT 2009

You can bypass the dialog by editing the DXL. It's unencrypted. You can find it here:

c:\<DOORS Install Path>\lib\dxl\standard\export\office\word.dxl

Re: Automating my MS Word Export...
jpoindex - Tue Feb 22 10:14:21 EST 2011

kbmurphy - Thu Oct 15 13:06:50 EDT 2009
You can bypass the dialog by editing the DXL. It's unencrypted. You can find it here:

c:\<DOORS Install Path>\lib\dxl\standard\export\office\word.dxl

I am trying to do the same. I dont want the UI, just run the export in batch mode. Does anyone know how to disable the dialog from being displayed?

Re: Automating my MS Word Export...
Mathias Mamsch - Tue Feb 22 10:50:10 EST 2011

jpoindex - Tue Feb 22 10:14:21 EST 2011
I am trying to do the same. I dont want the UI, just run the export in batch mode. Does anyone know how to disable the dialog from being displayed?

If you do not want the gui then you will have some major modifications to do to remove everything GUI related from the word.dxl. Why don't you want to have the GUI? Instead of running in batch mode, you can do an "Interactive Batch", meaning start DOORS in interactive mode, but with a commandline option to do an export of whatever module you need to, and exit_ doors after the export.

Regards, Mathias


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

Re: Automating my MS Word Export...
jpoindex - Thu Feb 24 15:56:15 EST 2011

Mathias Mamsch - Tue Feb 22 10:50:10 EST 2011
If you do not want the gui then you will have some major modifications to do to remove everything GUI related from the word.dxl. Why don't you want to have the GUI? Instead of running in batch mode, you can do an "Interactive Batch", meaning start DOORS in interactive mode, but with a commandline option to do an export of whatever module you need to, and exit_ doors after the export.

Regards, Mathias


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

Can you give me an example of running word.dxl in Interactive Batch mode. I have tried from the command using -b option and even the -D. I still get errors. I want to just try to bring up the word.dxl UI since it is a difficult to do without. Thanks

Re: Automating my MS Word Export...
Mathias Mamsch - Thu Feb 24 18:08:30 EST 2011

jpoindex - Thu Feb 24 15:56:15 EST 2011
Can you give me an example of running word.dxl in Interactive Batch mode. I have tried from the command using -b option and even the -D. I still get errors. I want to just try to bring up the word.dxl UI since it is a difficult to do without. Thanks

Create a file "export_batch.dxl". Put the following content in it:
 

// override some default message box functions, so they will only print the data but 
// not pause execution. Write to a log file here! 
 
bool confirm (string s) { print "Confirmed: " s "\n"; return true }
void ack (string s) {print "Acknowledge: " s "\n" }
void acknowledge (string s) {print "Acknowledge: " s "\n"  }
void infobox (string s) {print "Info: " s "\n" }
void info (string s) {print "Info: " s "\n" }
 
DB theDiag = null
 
// Now override block and show, to only do realize
void show  (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
 
if (null current Module) {
    print "You need to have a current Module set for the export."
        halt
}
 
// we need braces, since -D will be executed at top level and we will get name
// clashes for variable defined in word.dxl and the other includes of it.
{
        // now include the word.dxl -> this will pop up the dialog, but not halt execution
        // due to the overrides above
        #include <standard/export/office/word.dxl>
 
        // here we can change the dialog options. See itfui2.inc and word.dxl for all 
        // the options
        set(exportHeadingsToggle, false)   // turn off export of headings
 
        // now manually launch the export button callback
        doExport theDiag
 
        // get rid of the dialog
        if (!null theDiag) destroy theDiag
 
        // close DOORS
        exit_
}

 


Now create a batch file export.bat, and put the following in it:

 

 

 

@echo off
if "%~1"=="" ( 
    echo You need to start this script with a DOORS Module 
        goto :real_end
)
 
c:\programme\telelogic\DOORS_8.2\bin\doors.exe -f "%TEMP%" -D "current = read(\"%~1\", true); #include <export_batch.dxl>" -u Administrator
 
:real_end

 


Make sure that the export_batch.dxl and the export.bat are in the same directory. Then you can call it (from that directory, so that -D command can find the relative include!)

 

 

 

 

 

 

 

 

export.bat "/Test/My Module33"

 


Stuff like starting DOORS minimized or adding a parameter for the view to be exported, will be left as an exercise for the reader ;-) Hope this helps, Regards, Mathias

 

 

 

 

 

 

 

 


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

 

 

Re: Automating my MS Word Export...
WorkingStudent - Thu Mar 24 11:19:04 EDT 2011

Hey All,
I´ve got a probleme and i don´t know how to solve it:
Is it possible to have this script with the differnce, that you can do the export for a project and not only for a single module?

Thanks,
Clemens

Re: Automating my MS Word Export...
Mathias Mamsch - Fri Mar 25 05:46:05 EDT 2011

WorkingStudent - Thu Mar 24 11:19:04 EDT 2011
Hey All,
I´ve got a probleme and i don´t know how to solve it:
Is it possible to have this script with the differnce, that you can do the export for a project and not only for a single module?

Thanks,
Clemens

Just wrap the script in another script, that will do: for item in project do { current = read (fullName I, false); otherscript ... }. Should be doable. Regards, Mathias


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

Re: Automating my MS Word Export...
faisal.zahidi@boeing.com - Wed Oct 05 19:10:48 EDT 2011

Mathias Mamsch - Fri Mar 25 05:46:05 EDT 2011
Just wrap the script in another script, that will do: for item in project do { current = read (fullName I, false); otherscript ... }. Should be doable. Regards, Mathias


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

Mathias,

Your automation word script is what I have been looking for last couple days. I want to export multiple
selected module from the GUI. Here what I have done....
My script showing all the modules from the current folder and displaying it on a GUI which has export button. I have the option to select multiple modules from the GUI and allows me to export by pressing the export button.

My script calls your scripts to export multiple modules. Works partially!

There are two issues I am encountering:

1. It exports the view to Book format. But I want to export it to Table format. How to change it in your script so that I can export all module to Table format ONLY.

2. Word export GUI pops up before my GUI shows up. I have to close the word export GUI and then select multiple modules from my GUI. How I can stop showing word export GUI.

I made minor changes to your script:

a) I have moved the following lines from your script to the top of my script

DB theDiag = null
#include <standard/export/office/word.dxl>

........
.........
..........

here is the function:
void exptMod(DB box)
{
int pos
bool closeIt
int total=0
string attName
int cnt=0
int counter=0
for pos in modListDBE do
{
cnt++
}
progressStart( copyDB, "Module Export in Progress...", "Something",cnt)
for pos in modListDBE do
{
string modName = getColumnValue(modListDBE, pos, 2) "/" getColumnValue(modListDBE, pos, 0)
string mName=getColumnValue(modListDBE, pos, 0)
if (open(module(modName)))
{
closeIt = false
}
else
{
closeIt = true
}
progressMessage("Exporting module " mName "...........")

destMod= read(modName, true, true)

if(null(destMod))
{
storeMsg("Unable to open the module "modName)
continue
}
else
{
destMod = read(modName, false)
load view "CSU VCRM View"
progressStep(counter++)
if (closeIt)
{
close(destMod)
}

// override some default message box functions, so they will only print the data but
// not pause execution. Write to a log file here!

bool confirm (string s) { print "Confirmed: " s "\n"; return true }
void ack (string s) {print "Acknowledge: " s "\n" }
void acknowledge (string s) {print "Acknowledge: " s "\n" }
void infobox (string s) {print "Info: " s "\n" }
void info (string s) {print "Info: " s "\n" }

// Now override block and show, to only do realize
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }

if (null current Module) {
print "You need to have a current Module set for the export."
halt
}

// we need braces, since -D will be executed at top level and we will get name
// clashes for variable defined in word.dxl and the other includes of it.

// now include the word.dxl -> this will pop up the dialog, but not halt execution
// due to the overrides above

// here we can change the dialog options. See itfui2.inc and word.dxl for all
// the options
set(exportHeadingsToggle, false) // turn off export of headings

// now manually launch the export button callback
doExport theDiag

// get rid of the dialog
if (!null theDiag) destroy theDiag

// close DOORS
// exit_

}

}
progressStop
// displayMessages
} // copyAttsCB

Re: Automating my MS Word Export...
Mathias Mamsch - Fri Oct 07 00:58:52 EDT 2011

faisal.zahidi@boeing.com - Wed Oct 05 19:10:48 EDT 2011
Mathias,

Your automation word script is what I have been looking for last couple days. I want to export multiple
selected module from the GUI. Here what I have done....
My script showing all the modules from the current folder and displaying it on a GUI which has export button. I have the option to select multiple modules from the GUI and allows me to export by pressing the export button.

My script calls your scripts to export multiple modules. Works partially!

There are two issues I am encountering:

1. It exports the view to Book format. But I want to export it to Table format. How to change it in your script so that I can export all module to Table format ONLY.

2. Word export GUI pops up before my GUI shows up. I have to close the word export GUI and then select multiple modules from my GUI. How I can stop showing word export GUI.

I made minor changes to your script:

a) I have moved the following lines from your script to the top of my script

DB theDiag = null
#include <standard/export/office/word.dxl>

........
.........
..........

here is the function:
void exptMod(DB box)
{
int pos
bool closeIt
int total=0
string attName
int cnt=0
int counter=0
for pos in modListDBE do
{
cnt++
}
progressStart( copyDB, "Module Export in Progress...", "Something",cnt)
for pos in modListDBE do
{
string modName = getColumnValue(modListDBE, pos, 2) "/" getColumnValue(modListDBE, pos, 0)
string mName=getColumnValue(modListDBE, pos, 0)
if (open(module(modName)))
{
closeIt = false
}
else
{
closeIt = true
}
progressMessage("Exporting module " mName "...........")

destMod= read(modName, true, true)

if(null(destMod))
{
storeMsg("Unable to open the module "modName)
continue
}
else
{
destMod = read(modName, false)
load view "CSU VCRM View"
progressStep(counter++)
if (closeIt)
{
close(destMod)
}

// override some default message box functions, so they will only print the data but
// not pause execution. Write to a log file here!

bool confirm (string s) { print "Confirmed: " s "\n"; return true }
void ack (string s) {print "Acknowledge: " s "\n" }
void acknowledge (string s) {print "Acknowledge: " s "\n" }
void infobox (string s) {print "Info: " s "\n" }
void info (string s) {print "Info: " s "\n" }

// Now override block and show, to only do realize
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }

if (null current Module) {
print "You need to have a current Module set for the export."
halt
}

// we need braces, since -D will be executed at top level and we will get name
// clashes for variable defined in word.dxl and the other includes of it.

// now include the word.dxl -> this will pop up the dialog, but not halt execution
// due to the overrides above

// here we can change the dialog options. See itfui2.inc and word.dxl for all
// the options
set(exportHeadingsToggle, false) // turn off export of headings

// now manually launch the export button callback
doExport theDiag

// get rid of the dialog
if (!null theDiag) destroy theDiag

// close DOORS
// exit_

}

}
progressStop
// displayMessages
} // copyAttsCB

Try posting your code using the {co de} tag (remove space) next time. It makes it much more readable.

Anyway, you cannot do it like that. The gist of my post was that the redirection of the show and block functions must occur before the include. You are getting an exporter box you need to click on, because the redefinition of show is done after the include.

As you probably noticed, you cannot just move the include down to the redefinition without getting errors. This is because global variables in that include file will not be global anymore if you put the include in a function. Therefore you cannot have a function around your export code.

So refactor your code, that the call of the exporter dialog will happen on main level again, i.e. whereever you call your exptMod function, move the code and the include statement there. Return all necessary variables for that code by references in the expmod function (or any other functions around this). If this code gets to ugly you need to strip all globals from the exporter code, put them in a separate include and include this at the top. Then you can happily move the include down below the redirection and everything shall work fine.

Hope that helps, regards, Mathias

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

Re: Automating my MS Word Export...
faisal.zahidi@boeing.com - Tue Oct 11 18:25:19 EDT 2011

Mathias Mamsch - Fri Oct 07 00:58:52 EDT 2011
Try posting your code using the {co de} tag (remove space) next time. It makes it much more readable.

Anyway, you cannot do it like that. The gist of my post was that the redirection of the show and block functions must occur before the include. You are getting an exporter box you need to click on, because the redefinition of show is done after the include.

As you probably noticed, you cannot just move the include down to the redefinition without getting errors. This is because global variables in that include file will not be global anymore if you put the include in a function. Therefore you cannot have a function around your export code.

So refactor your code, that the call of the exporter dialog will happen on main level again, i.e. whereever you call your exptMod function, move the code and the include statement there. Return all necessary variables for that code by references in the expmod function (or any other functions around this). If this code gets to ugly you need to strip all globals from the exporter code, put them in a separate include and include this at the top. Then you can happily move the include down below the redirection and everything shall work fine.

Hope that helps, regards, Mathias


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

Mathias,

Hmm...Interesting. Now it is clear why it was showing the Word export GUI. Thank

However, it was not clear what you mean by "wherever you call your exptMod function,move the code and the include statement there"...Where???

exptMod function is called by the export button in my GUI function. please explain...

Here is a pseudo code. can you give me a hint how you would have rearrange the code....

DB theDiag = null
#include <standard/export/office/word.dxl>

void exptMod(DB BD)
{

for selectedMod in the listbox do
{

void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }

if (null destMod)
{
print "You need to have a current Module set for the export."
halt
}
set(exportHeadingsToggle, false)

doExport theDiag

if (!null theDiag) destroy theDiag
}

}

void myGUI()
{

.......
.......
.......

okBtnDBE = ok(copyDB, "Export", exptMod)

}
myGUI()

Re: Automating my MS Word Export...
Mathias Mamsch - Tue Oct 11 18:49:21 EDT 2011

faisal.zahidi@boeing.com - Tue Oct 11 18:25:19 EDT 2011
Mathias,

Hmm...Interesting. Now it is clear why it was showing the Word export GUI. Thank

However, it was not clear what you mean by "wherever you call your exptMod function,move the code and the include statement there"...Where???

exptMod function is called by the export button in my GUI function. please explain...

Here is a pseudo code. can you give me a hint how you would have rearrange the code....

DB theDiag = null
#include <standard/export/office/word.dxl>

void exptMod(DB BD)
{

for selectedMod in the listbox do
{

void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }

if (null destMod)
{
print "You need to have a current Module set for the export."
halt
}
set(exportHeadingsToggle, false)

doExport theDiag

if (!null theDiag) destroy theDiag
}

}

void myGUI()
{

.......
.......
.......

okBtnDBE = ok(copyDB, "Export", exptMod)

}
myGUI()

The idea was to get rid of the function, so you will have no global variable problem. The include must not be placed inside a function. Since this is not possible in your case I suggest an eval_ approach:
 

string expCode = "
DB theDiag = null
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
 
#include <standard/export/office/word.dxl>
set(exportHeadingsToggle, false)
doExport theDiag
if (!null theDiag) destroy theDiag
"
 
string exportCode (string sFullName) {
    string sExportCode = "
        Module mod = read(\"" sFullName "\", true)
        current = mod
        " expCode "
        close mod
    "
 
   return sExportCode
}
 
void exptMod(DB BD)
{
   for selectedMod in the listbox do
   {
       eval_ exportCode selectedMod
   }
}

 

 


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

 

 

Re: Automating my MS Word Export...
faisal.zahidi@boeing.com - Wed Oct 12 16:06:06 EDT 2011

Mathias Mamsch - Tue Oct 11 18:49:21 EDT 2011

The idea was to get rid of the function, so you will have no global variable problem. The include must not be placed inside a function. Since this is not possible in your case I suggest an eval_ approach:
 

string expCode = "
DB theDiag = null
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
 
#include <standard/export/office/word.dxl>
set(exportHeadingsToggle, false)
doExport theDiag
if (!null theDiag) destroy theDiag
"
 
string exportCode (string sFullName) {
    string sExportCode = "
        Module mod = read(\"" sFullName "\", true)
        current = mod
        " expCode "
        close mod
    "
 
   return sExportCode
}
 
void exptMod(DB BD)
{
   for selectedMod in the listbox do
   {
       eval_ exportCode selectedMod
   }
}

 

 


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

 

 

Mathias,

WORKS!!!.
The dxl is looping thru and exporting all modules. Thanks a lot!!!.

Last question, the default word export dxl exports the module in book format. But I want the default export be in table format.

How to force dxl to export it to table format????

Is there any documentation in dxl help where I can get all word export functions so that I can manipulate each function such as layout, OLE and page orientation etc.
FZ

Re: Automating my MS Word Export...
Mathias Mamsch - Thu Oct 13 09:09:35 EDT 2011

faisal.zahidi@boeing.com - Wed Oct 12 16:06:06 EDT 2011
Mathias,

WORKS!!!.
The dxl is looping thru and exporting all modules. Thanks a lot!!!.

Last question, the default word export dxl exports the module in book format. But I want the default export be in table format.

How to force dxl to export it to table format????

Is there any documentation in dxl help where I can get all word export functions so that I can manipulate each function such as layout, OLE and page orientation etc.
FZ

You need to look at the library files of DOORS (they are not encrypted!). In itfutil.inc I find:
 

...
const int layoutTypeBook                        = 0
const int layoutTypeTable                               = 1
const int layoutTypeMax                                 = 2
const int layoutTypeDefault                             = layoutTypeBook
 
const string layoutNameBook                             = "Book"
const string layoutNameTable                            = "Table"
 
const string layoutNamesBookOnly[]                      = {layoutNameBook}
const string layoutNamesAll[]                           = {layoutNameBook, layoutNameTable}
...

 


in itfui2.inc I find:

 

 

 

...
void makeExporterUI(string dbTitle, int helpId, bool includeFilename, bool bookOnly, string extension, description) {
    Module m = current
    int widgetCount = 0
        
    exportBox = create(m,dbTitle, styleFixed_ | styleCentered_)
 
    ...
 
    if (bookOnly) {
        exportLayoutChoice = choice(exportBox,layoutLabel, layoutNamesBookOnly, layoutTypeDefault)
    } else {
        exportLayoutChoice = choice(exportBox,layoutLabel, layoutNamesAll, layoutTypeDefault)
    }
...



Therefore I would think (without trying), that changing your code to:



 

 

 

string expCode = "
DB theDiag = null
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
 
#include <standard/export/office/word.dxl>
set(exportHeadingsToggle, false)
set(exportLayoutChoice, layoutTypeBook) // <<- add this line
doExport theDiag
if (!null theDiag) destroy theDiag
"



might do the trick ;-) I think you get the idea. Regards, Mathias



 

 


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

 

Re: Automating my MS Word Export...
faisal.zahidi@boeing.com - Wed Mar 07 14:01:52 EST 2012

Mathias,

Do you know how I can set a view so that all the modules will use the user defined view, not the standard view. I tried to load the view after the module is opened, but the dxl didnot like it.

string sExportCode = "
Module destMod= read(\"" sFullName "\", true)
load view ("myview")

And I also want to apply user defined template, not the normal.dot. How to change code and make it happend.

My impression was that the set function will allow me to change the template

set(exportHeadingsToggle, false)
set(exportLayoutChoice, layoutTypeBook)
set(autoformatToggle,false)
set templateName ="c:\temp\mytemplate.dot" //here is the problem..

Re: Automating my MS Word Export...
Mathias Mamsch - Fri Mar 09 12:05:59 EST 2012

faisal.zahidi@boeing.com - Wed Mar 07 14:01:52 EST 2012
Mathias,

Do you know how I can set a view so that all the modules will use the user defined view, not the standard view. I tried to load the view after the module is opened, but the dxl didnot like it.

string sExportCode = "
Module destMod= read(\"" sFullName "\", true)
load view ("myview")

And I also want to apply user defined template, not the normal.dot. How to change code and make it happend.

My impression was that the set function will allow me to change the template

set(exportHeadingsToggle, false)
set(exportLayoutChoice, layoutTypeBook)
set(autoformatToggle,false)
set templateName ="c:\temp\mytemplate.dot" //here is the problem..

A new thread would have been better suited for this question. And if you post the same question twice and additionally mail it you will normally decrease the chance of getting an answer, not increase it!

You should try something like this:
 

set(advancedNormalTemplateToggle, false) 
set(advancedTemplateLabel, "c:/path/to/my/template.dot")

 


Also you need to be very careful about " when you put DXL code in a string:

 

 

 

string sExportCode = "
Module destMod= read(\"" sFullName "\", true)
current = destMod
load view (\"myview\")
"



should do the trick, I think you forgot the \ in front of the ". Maybe that help, regards, Mathias



 

 

 


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

 

Re: Automating my MS Word Export...
faisal.zahidi@boeing.com - Fri Mar 09 15:06:44 EST 2012

Mathias Mamsch - Fri Mar 09 12:05:59 EST 2012

A new thread would have been better suited for this question. And if you post the same question twice and additionally mail it you will normally decrease the chance of getting an answer, not increase it!

You should try something like this:
 

set(advancedNormalTemplateToggle, false) 
set(advancedTemplateLabel, "c:/path/to/my/template.dot")

 


Also you need to be very careful about " when you put DXL code in a string:

 

 

 

string sExportCode = "
Module destMod= read(\"" sFullName "\", true)
current = destMod
load view (\"myview\")
"



should do the trick, I think you forgot the \ in front of the ". Maybe that help, regards, Mathias



 

 

 


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

 

Mathias,

Thanks for your suggestion what is the best way to post new threads and the feedback for the code.
I encoutered a problem,

.....
set(exportHeadingsToggle, false)
set(exportLayoutChoice, layoutTypeBook)
set(autoformatToggle,false)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateLabel,"c:/temp/template.dot")

if I use the "c:/..." like the above code. I get an error message:

-E- DXL: <Line:49> incorrectly concatenated tokens
-E- DXL: <Line:49> undeclared variable (c)
-E- DXL: <Line:49> syntax error
-I- DXL: All done. Errors reported: 3. Warnings reported: 0.
set(advancedNormalTemplateToggle, false)
set(advancedTemplateLabel,c:/temp/template.dot)

If I don't use the "", Only the path c:/temp/template.dot, the GUI pops up and allows me to select modules then crushes. I get the following error message:

-E- DXL: <Line:16> syntax error
-E- DXL: <Line:16> undeclared variable (c)
-E- DXL: <Line:16> syntax error
-E- DXL: <Line:16> undeclared variable (c)

Any suggestion!

thanks

fz

Re: Automating my MS Word Export...
Mathias Mamsch - Sat Mar 10 08:08:09 EST 2012

faisal.zahidi@boeing.com - Fri Mar 09 15:06:44 EST 2012
Mathias,

Thanks for your suggestion what is the best way to post new threads and the feedback for the code.
I encoutered a problem,

.....
set(exportHeadingsToggle, false)
set(exportLayoutChoice, layoutTypeBook)
set(autoformatToggle,false)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateLabel,"c:/temp/template.dot")

if I use the "c:/..." like the above code. I get an error message:

-E- DXL: <Line:49> incorrectly concatenated tokens
-E- DXL: <Line:49> undeclared variable (c)
-E- DXL: <Line:49> syntax error
-I- DXL: All done. Errors reported: 3. Warnings reported: 0.
set(advancedNormalTemplateToggle, false)
set(advancedTemplateLabel,c:/temp/template.dot)

If I don't use the "", Only the path c:/temp/template.dot, the GUI pops up and allows me to select modules then crushes. I get the following error message:

-E- DXL: <Line:16> syntax error
-E- DXL: <Line:16> undeclared variable (c)
-E- DXL: <Line:16> syntax error
-E- DXL: <Line:16> undeclared variable (c)

Any suggestion!

thanks

fz

Read my comment again. You need to be careful with the " in the code. If you embed the code into a string, you need to escape the " characters. The reason that you got this message is that you tried to embed the code in a string and again forgot to escape the template string. Therefore he tried to do

"..." c :/ ...

 


Stopping at c, telling you it is an undeclared variable ... Regards, Mathias

 

 


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

 

Re: Automating my MS Word Export...
faisal.zahidi@boeing.com - Mon Mar 12 11:45:41 EDT 2012

Mathias Mamsch - Sat Mar 10 08:08:09 EST 2012

Read my comment again. You need to be careful with the " in the code. If you embed the code into a string, you need to escape the " characters. The reason that you got this message is that you tried to embed the code in a string and again forgot to escape the template string. Therefore he tried to do

"..." c :/ ...

 


Stopping at c, telling you it is an undeclared variable ... Regards, Mathias

 

 


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

 

Mathias,

Now I got really confused!!!
When you say escape the " character. what you mean by that??
If I don't use the " in the c:/temp/template.dot, the dxl allows me to launch the form. the next step is to select the modules from GUI and run. As soon as I do that again I get the same error message.

-E- DXL: <Line:16> incorrect arguments for function (set)
-E- DXL: <Line:18> syntax error
-E- DXL: <Line:18> undeclared variable (c)

Here is the code. can you show me what you are trying to say...
string expCode = "
DB theDiag = null
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
#include <standard/export/office/word.dxl>
set(exportHeadingsToggle, false)
set(exportLayoutChoice, layoutTypeBook)
set(autoformatToggle,false)
set(useNormalTemplate,false)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateLabel,c:/temp/template.dot)

doExport theDiag
if (!null theDiag) destroy theDiag
"
...........................
.........................
Thanks,

Appreciate it!!

FZ

Re: Automating my MS Word Export...
SystemAdmin - Mon Mar 12 13:21:36 EDT 2012

faisal.zahidi@boeing.com - Mon Mar 12 11:45:41 EDT 2012
Mathias,

Now I got really confused!!!
When you say escape the " character. what you mean by that??
If I don't use the " in the c:/temp/template.dot, the dxl allows me to launch the form. the next step is to select the modules from GUI and run. As soon as I do that again I get the same error message.

-E- DXL: <Line:16> incorrect arguments for function (set)
-E- DXL: <Line:18> syntax error
-E- DXL: <Line:18> undeclared variable (c)

Here is the code. can you show me what you are trying to say...
string expCode = "
DB theDiag = null
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
#include <standard/export/office/word.dxl>
set(exportHeadingsToggle, false)
set(exportLayoutChoice, layoutTypeBook)
set(autoformatToggle,false)
set(useNormalTemplate,false)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateLabel,c:/temp/template.dot)

doExport theDiag
if (!null theDiag) destroy theDiag
"
...........................
.........................
Thanks,

Appreciate it!!

FZ

Hello FZ,

about "escaping":
let's go back one step.

you need to define a string that contains the " character, because the set command needs a string as its second parameter.

In DXL, as in many other languages, the content of the string is enclosed in " characters.
So, in a usual code you would write the line

string s = "<This is a string>"

 


If you execute this code, you have a variable which contains the text

 

 

<This is a string>


Now, if you want to have a variable which contains the text

 

 

<This is a string having the character " in the middle>


and you would write it in this way:

 

 

string s ="<This is a string having the character " in the middle>"


then the parser would read the line and think that the content of the string ends after the second " character.
So, DXL would think that string s shall contain

 

 

<This is a string having the character


and afterwards it would find some gibberish command

 

 

in the middle>


and would complain, because such a command makes no sense.

So, what do you do to tell DXL that you actually want a " character in the middle of the string? You tell it that the " character shall not be the end of the string, it shall be read just as it is.
This is done by preceding the " character with a so-called "escape"-character. This escape character says: ignore the next character you find in the code.
In DXL, the escape character is the backslash \
To conclude the example, you would have to write the code as such

 

 

string s = "<This is a string having the character \" in the middle>"


(I hope that your browser or email client does not mess up this line. There is a backslash, then a quotation mark.

And finally, to come back to your original question, you would have to write the following line:

 

 

set(advancedTemplateLabel,"\c:/temp/template.dot"\)


because your string begins in line 1 (string expCode= ") and ends in the line containing only a " character. All " in the middle must be preceded (escaped) by a \
Hope this helps.
Regards,
Mike

PS: http://en.wikipedia.org/wiki/Escape_character

 

Re: Automating my MS Word Export...
llandale - Tue Mar 13 13:15:01 EDT 2012

SystemAdmin - Mon Mar 12 13:21:36 EDT 2012

Hello FZ,

about "escaping":
let's go back one step.

you need to define a string that contains the " character, because the set command needs a string as its second parameter.

In DXL, as in many other languages, the content of the string is enclosed in " characters.
So, in a usual code you would write the line

string s = "<This is a string>"

 


If you execute this code, you have a variable which contains the text

 

 

<This is a string>


Now, if you want to have a variable which contains the text

 

 

<This is a string having the character " in the middle>


and you would write it in this way:

 

 

string s ="<This is a string having the character " in the middle>"


then the parser would read the line and think that the content of the string ends after the second " character.
So, DXL would think that string s shall contain

 

 

<This is a string having the character


and afterwards it would find some gibberish command

 

 

in the middle>


and would complain, because such a command makes no sense.

So, what do you do to tell DXL that you actually want a " character in the middle of the string? You tell it that the " character shall not be the end of the string, it shall be read just as it is.
This is done by preceding the " character with a so-called "escape"-character. This escape character says: ignore the next character you find in the code.
In DXL, the escape character is the backslash \
To conclude the example, you would have to write the code as such

 

 

string s = "<This is a string having the character \" in the middle>"


(I hope that your browser or email client does not mess up this line. There is a backslash, then a quotation mark.

And finally, to come back to your original question, you would have to write the following line:

 

 

set(advancedTemplateLabel,"\c:/temp/template.dot"\)


because your string begins in line 1 (string expCode= ") and ends in the line containing only a " character. All " in the middle must be preceded (escaped) by a \
Hope this helps.
Regards,
Mike

PS: http://en.wikipedia.org/wiki/Escape_character

 

I may not be following this thread correctly, but perhaps you have the slashes in the wrong spot:
  • from .. set(advancedTemplateLabel,"\c:/temp/template.dot"\)
  • to ...... set(advancedTemplateLabel,\"c:/temp/template.dot\")
If the file path had front slashes instead of back slashes, you would need to escape them as well:
Run this code:
  • print "set(advancedTemplateLabel,\"c:\\temp\\template.dot\")"
and you get this:
  • set(advancedTemplateLabel,"c:\temp\template.dot")

Confused? There are 3 people in the entire world who visualize this effortlessly, I'm not one of them. So I type what I want to see, then add an escape front-slash in front of the double quotes and front-slashes. When I have such strings that are not working, I try to just print the parts.

-Louie

Re: Automating my MS Word Export...
SystemAdmin - Tue Mar 13 13:27:39 EDT 2012

llandale - Tue Mar 13 13:15:01 EDT 2012
I may not be following this thread correctly, but perhaps you have the slashes in the wrong spot:

  • from .. set(advancedTemplateLabel,"\c:/temp/template.dot"\)
  • to ...... set(advancedTemplateLabel,\"c:/temp/template.dot\")
If the file path had front slashes instead of back slashes, you would need to escape them as well:
Run this code:
  • print "set(advancedTemplateLabel,\"c:\\temp\\template.dot\")"
and you get this:
  • set(advancedTemplateLabel,"c:\temp\template.dot")

Confused? There are 3 people in the entire world who visualize this effortlessly, I'm not one of them. So I type what I want to see, then add an escape front-slash in front of the double quotes and front-slashes. When I have such strings that are not working, I try to just print the parts.

-Louie

> from .. set(advancedTemplateLabel,"\c:/temp/template.dot"\) to .. \" ..

Oops, I stand corrected. Thanks for proof reading my mail:-)

Mike

Re: Automating my MS Word Export...
faisal.zahidi@boeing.com - Tue Mar 13 14:43:09 EDT 2012

SystemAdmin - Tue Mar 13 13:27:39 EDT 2012
> from .. set(advancedTemplateLabel,"\c:/temp/template.dot"\) to .. \" ..

Oops, I stand corrected. Thanks for proof reading my mail:-)

Mike

Louie/Mike,

If I use the following code:

set(advancedTemplateLabel,\"c:/temp/template.dot\")

I get an error message:

-E- DXL: <Line:16> incorrect arguments for function (set)

Am I doing something wrong????

Thanks,

Faisal Zahidi

Re: Automating my MS Word Export...
llandale - Tue Mar 13 16:21:21 EDT 2012

faisal.zahidi@boeing.com - Tue Mar 13 14:43:09 EDT 2012
Louie/Mike,

If I use the following code:

set(advancedTemplateLabel,\"c:/temp/template.dot\")

I get an error message:

-E- DXL: <Line:16> incorrect arguments for function (set)

Am I doing something wrong????

Thanks,

Faisal Zahidi

You escape when you are sending the string elsewhere, in this case I think its the "eval_" function. If you are just coding and running you don't need them.
  • set(advancedTemplateLabel,"c:/temp/template.dot") // this works
  • eval_("set(advancedTemplateLabel,\"c:/temp/template.dot\")") // this sends it elsewhere

..err.. I should say you need to escape when the quotes and the slashes are inside some other string.
  • print "set(advancedTemplateLabel,\"c:/temp/template.dot\")\n"

Re: Automating my MS Word Export...
SystemAdmin - Wed Aug 08 10:56:58 EDT 2012

Mathias Mamsch - Fri Mar 09 12:05:59 EST 2012

A new thread would have been better suited for this question. And if you post the same question twice and additionally mail it you will normally decrease the chance of getting an answer, not increase it!

You should try something like this:
 

set(advancedNormalTemplateToggle, false) 
set(advancedTemplateLabel, "c:/path/to/my/template.dot")

 


Also you need to be very careful about " when you put DXL code in a string:

 

 

 

string sExportCode = "
Module destMod= read(\"" sFullName "\", true)
current = destMod
load view (\"myview\")
"



should do the trick, I think you forgot the \ in front of the ". Maybe that help, regards, Mathias



 

 

 


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

 

Hello,

Is there a way of saving the export once it is complete?

Thank you,
-Jim
 

Skip selectedItems = getSelectedItems ()
Item I = null
for I in selectedItems do
{
    if(isDeleted(I) || null I) {continue}
        if (type (I) == "Formal")
        {
                Module m = read(fullName(I),true)
                load view "Standard view"
                delete column 0
                {
                        // override some default message box functions, so they will only print the data but 
                        // not pause execution. Write to a log file here! 
                         
                        bool confirm (string s) { print "Confirmed: " s "\n"; return true }
                        void ack (string s) {print "Acknowledge: " s "\n" }
                        void acknowledge (string s) {print "Acknowledge: " s "\n"  }
                        void infobox (string s) {print "Info: " s "\n" }
                        void info (string s) {print "Info: " s "\n" }
                         
                        DB theDiag = null
                         
                        // Now override block and show, to only do realize
                        void show  (DB x) { realize x; theDiag = x }
                        void block (DB x) { realize x; theDiag = x }
                         
                        if (null current Module) {
                                print "You need to have a current Module set for the export."
                                halt
                        }
                         
                        // we need braces, since -D will be executed at top level and we will get name
                        // clashes for variable defined in word.dxl and the other includes of it.
                        {
                                // now include the word.dxl -> this will pop up the dialog, but not halt execution
                                // due to the overrides above
                                #include <standard/export/office/word.dxl>
                         
                                // here we can change the dialog options. See itfui2.inc and word.dxl for all 
                                // the options
                                set(exportHeadingsToggle, false)   // turn off export of headings
                                set(exportWarnUnregOLE,false)   //turn off ole warning
                         
                                // now manually launch the export button callback
                                doExport theDiag
                         
                                // get rid of the dialog
                                if (!null theDiag) destroy theDiag
                         
                                // close DOORS
                                //exit_
                        }
                }
                close(m)
        }
}
 
delete selectedItems

Re: Automating my MS Word Export...
SystemAdmin - Wed Mar 13 23:44:35 EDT 2013

SystemAdmin - Wed Aug 08 10:56:58 EDT 2012

Hello,

Is there a way of saving the export once it is complete?

Thank you,
-Jim
 

Skip selectedItems = getSelectedItems ()
Item I = null
for I in selectedItems do
{
    if(isDeleted(I) || null I) {continue}
        if (type (I) == "Formal")
        {
                Module m = read(fullName(I),true)
                load view "Standard view"
                delete column 0
                {
                        // override some default message box functions, so they will only print the data but 
                        // not pause execution. Write to a log file here! 
                         
                        bool confirm (string s) { print "Confirmed: " s "\n"; return true }
                        void ack (string s) {print "Acknowledge: " s "\n" }
                        void acknowledge (string s) {print "Acknowledge: " s "\n"  }
                        void infobox (string s) {print "Info: " s "\n" }
                        void info (string s) {print "Info: " s "\n" }
                         
                        DB theDiag = null
                         
                        // Now override block and show, to only do realize
                        void show  (DB x) { realize x; theDiag = x }
                        void block (DB x) { realize x; theDiag = x }
                         
                        if (null current Module) {
                                print "You need to have a current Module set for the export."
                                halt
                        }
                         
                        // we need braces, since -D will be executed at top level and we will get name
                        // clashes for variable defined in word.dxl and the other includes of it.
                        {
                                // now include the word.dxl -> this will pop up the dialog, but not halt execution
                                // due to the overrides above
                                #include <standard/export/office/word.dxl>
                         
                                // here we can change the dialog options. See itfui2.inc and word.dxl for all 
                                // the options
                                set(exportHeadingsToggle, false)   // turn off export of headings
                                set(exportWarnUnregOLE,false)   //turn off ole warning
                         
                                // now manually launch the export button callback
                                doExport theDiag
                         
                                // get rid of the dialog
                                if (!null theDiag) destroy theDiag
                         
                                // close DOORS
                                //exit_
                        }
                }
                close(m)
        }
}
 
delete selectedItems

Hi Elliscnck,

Can you please post the batch how to call the script you post in the thread? It's no response when I run this in DOORS GUI.

Thanks,
Gary

Re: Automating my MS Word Export...
SystemAdmin - Thu Mar 14 00:14:24 EDT 2013

SystemAdmin - Wed Aug 08 10:56:58 EDT 2012

Hello,

Is there a way of saving the export once it is complete?

Thank you,
-Jim
 

Skip selectedItems = getSelectedItems ()
Item I = null
for I in selectedItems do
{
    if(isDeleted(I) || null I) {continue}
        if (type (I) == "Formal")
        {
                Module m = read(fullName(I),true)
                load view "Standard view"
                delete column 0
                {
                        // override some default message box functions, so they will only print the data but 
                        // not pause execution. Write to a log file here! 
                         
                        bool confirm (string s) { print "Confirmed: " s "\n"; return true }
                        void ack (string s) {print "Acknowledge: " s "\n" }
                        void acknowledge (string s) {print "Acknowledge: " s "\n"  }
                        void infobox (string s) {print "Info: " s "\n" }
                        void info (string s) {print "Info: " s "\n" }
                         
                        DB theDiag = null
                         
                        // Now override block and show, to only do realize
                        void show  (DB x) { realize x; theDiag = x }
                        void block (DB x) { realize x; theDiag = x }
                         
                        if (null current Module) {
                                print "You need to have a current Module set for the export."
                                halt
                        }
                         
                        // we need braces, since -D will be executed at top level and we will get name
                        // clashes for variable defined in word.dxl and the other includes of it.
                        {
                                // now include the word.dxl -> this will pop up the dialog, but not halt execution
                                // due to the overrides above
                                #include <standard/export/office/word.dxl>
                         
                                // here we can change the dialog options. See itfui2.inc and word.dxl for all 
                                // the options
                                set(exportHeadingsToggle, false)   // turn off export of headings
                                set(exportWarnUnregOLE,false)   //turn off ole warning
                         
                                // now manually launch the export button callback
                                doExport theDiag
                         
                                // get rid of the dialog
                                if (!null theDiag) destroy theDiag
                         
                                // close DOORS
                                //exit_
                        }
                }
                close(m)
        }
}
 
delete selectedItems

Hi Elliscnck,

I can run your DXL script after selected the document items from DOORS database view. Did you have the answer already how to save the export once it is complete? If yes, it would be great if you can share with us.

Many thanks,
Gary

Re: Automating my MS Word Export...
Mathias Mamsch - Tue Mar 19 05:23:07 EDT 2013

SystemAdmin - Thu Mar 14 00:14:24 EDT 2013
Hi Elliscnck,

I can run your DXL script after selected the document items from DOORS database view. Did you have the answer already how to save the export once it is complete? If yes, it would be great if you can share with us.

Many thanks,
Gary

When you automate a script like this, then since you do not want to change the script, what you normally do is hook into some perms, to get handles to the variables you want. In this case it could be something like:
 

... 
bool confirm (string s) { print "Confirmed: " s "\n"; return true }
void ack (string s) {print "Acknowledge: " s "\n" }
void acknowledge (string s) {print "Acknowledge: " s "\n"  }
void infobox (string s) {print "Info: " s "\n" }
 
// ...
// Hook the OleAutoObject creation function here: 
 
OleAutoObj gObjWordApplication = null
 
OleAutoObj oleCreateAutoObjectOld (string s) { return oleCreateAutoObject s }
OleAutoObj oleGetAutoObjectOld (string s) { return oleCreateAutoObject s }
                 
OleAutoObj oleCreateAutoObject (string s) { 
     OleAutoObj result = oleCreateAutoObjectOld s
     if (s == "Word.Application") gObjWordApplication = result
     return result
}
 
OleAutoObj oleGetAutoObject (string s) { 
     OleAutoObj result = oleGetAutoObjectOld s
     if (s == "Word.Application") gObjWordApplication = result
     return result
}
 
// ... the rest of the export code ...
 
                         
doExport theDiag                         
if (!null theDiag) destroy theDiag
 
// Use the handle here to get a grip on the documents, save them. 
// ... 
 
                         
// close DOORS
// exit_
// ...

 


Of course if there is a global variable available from the code and the code is not encrypted, you can also use the global variable directly. However this is not always the case, this solution will always work. Another note: instead of comparing to "Word.Application" you might use something more sophisticated to catch all possible cases.

Maybe that helps, regards, Mathias

 

 


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

 

Re: Automating my MS Word Export...
SystemAdmin - Thu Apr 04 10:43:03 EDT 2013

Hello. I have a question related to the initial post:

With regards to the user-submitted scripts on the first page, how would i modify them to use a different EXPORTDIRECTORY (in automation)?

NOTE: I modified the dxl script to use the rtfexp.dxl script, not word.dxl.

I've tried to
 

string exportDirectory = "\\c:\\Documents and Settings\\user\\newFolder"  
setenv("EXPORTDIRECTORY", getDirOfNoSlash(exportDirectory))

 


and similarly tried to just 'set EXPORTDIRECTORY "c:\Documents and Settings\user\newFolder"' from the top-level batch script, but neither seem to work. The output always goes to MyDocuments.

 

Re: Automating my MS Word Export...
Mathias Mamsch - Thu Apr 04 13:39:25 EDT 2013

SystemAdmin - Thu Apr 04 10:43:03 EDT 2013

Hello. I have a question related to the initial post:

With regards to the user-submitted scripts on the first page, how would i modify them to use a different EXPORTDIRECTORY (in automation)?

NOTE: I modified the dxl script to use the rtfexp.dxl script, not word.dxl.

I've tried to
 

string exportDirectory = "\\c:\\Documents and Settings\\user\\newFolder"  
setenv("EXPORTDIRECTORY", getDirOfNoSlash(exportDirectory))

 


and similarly tried to just 'set EXPORTDIRECTORY "c:\Documents and Settings\user\newFolder"' from the top-level batch script, but neither seem to work. The output always goes to MyDocuments.

 

I think you should be able to manipulate the "exportFileName" DBE just like with all the other exports? Did you try setting the filename explicitly? Regards, Mathias


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

Re: Automating my MS Word Export...
llandale - Thu Apr 04 14:24:17 EDT 2013

SystemAdmin - Thu Apr 04 10:43:03 EDT 2013

Hello. I have a question related to the initial post:

With regards to the user-submitted scripts on the first page, how would i modify them to use a different EXPORTDIRECTORY (in automation)?

NOTE: I modified the dxl script to use the rtfexp.dxl script, not word.dxl.

I've tried to
 

string exportDirectory = "\\c:\\Documents and Settings\\user\\newFolder"  
setenv("EXPORTDIRECTORY", getDirOfNoSlash(exportDirectory))

 


and similarly tried to just 'set EXPORTDIRECTORY "c:\Documents and Settings\user\newFolder"' from the top-level batch script, but neither seem to work. The output always goes to MyDocuments.

 

Your code works for me without the getDirOfNoSlash() call. setenv() takes effect immediately, and can be seen in the Registry.

This may surprise you:
  • string exportDirectory = "\\c:\\Documents and Settings\\user\\newFolder"
  • string exportNoSlash = getDirOfNoSlash(exportDirectory)
  • print "Export: >>" exportDirectory "<<\n"
  • print "NoSlash:>>" exportNoSlash "<<\n"

So try just this:
  • setenv("EXPORTDIRECTORY", "\\c:\\Documents and Settings\\user\\newFolder")

-Louie

Re: Automating my MS Word Export...
dalvia - Fri Dec 27 17:17:30 EST 2013

llandale - Thu Apr 04 14:24:17 EDT 2013
Your code works for me without the getDirOfNoSlash() call. setenv() takes effect immediately, and can be seen in the Registry.

This may surprise you:

  • string exportDirectory = "\\c:\\Documents and Settings\\user\\newFolder"
  • string exportNoSlash = getDirOfNoSlash(exportDirectory)
  • print "Export: >>" exportDirectory "<<\n"
  • print "NoSlash:>>" exportNoSlash "<<\n"

So try just this:
  • setenv("EXPORTDIRECTORY", "\\c:\\Documents and Settings\\user\\newFolder")

-Louie

Thanks everyone for posting snippets. Almost getting mine to work. Only problem is that I can't seem to set output file name for the word document. I tried this-

set(exportFileName,"c:/tmp/temp.doc")

and I get this error-

-R-E- DXL: <export_batch.dxl:34> null dialog element (DBE) parameter was passed into argument position 1
-I- DXL: execution halted

My guess is that  the exportFileName DBE isn't getting allocated. I tried doing it, but no use. Any ideas ? 

Re: Automating my MS Word Export...
Mathias Mamsch - Thu Jan 02 12:49:05 EST 2014

dalvia - Fri Dec 27 17:17:30 EST 2013

Thanks everyone for posting snippets. Almost getting mine to work. Only problem is that I can't seem to set output file name for the word document. I tried this-

set(exportFileName,"c:/tmp/temp.doc")

and I get this error-

-R-E- DXL: <export_batch.dxl:34> null dialog element (DBE) parameter was passed into argument position 1
-I- DXL: execution halted

My guess is that  the exportFileName DBE isn't getting allocated. I tried doing it, but no use. Any ideas ? 

Please post your export_batch.dxl (or the relevant parts of it)... The variable name seems to be right, however if you try manipulating it before it is allocated it seems that you try to do it in the wrong position. Make sure, that the dialog has already been created and is visible on the screen, before putting the set(...) statement. Regards, Mathias

Re: Automating my MS Word Export...
dalvia - Thu Jan 02 13:08:35 EST 2014

I have made some progress since. I can see the outpuit filename I want in dialog box after it is created. However the actual word file does not get saved. My export_batch.dxl script has been attached. Also had to make 1 line change in word.dxl so that the DBE for data export file name is allocated

Changed this line ( line 3341 )

makeExporterUI(wordTitle, helpExportWord, false, false, null, null)

to ( mde 3rd argument true )

makeExporterUI(wordTitle, helpExportWord, true, false, null, null)

Now the dialog boz gets created. I can see the file name that I set ( "c:/adi.doc") on the dialog box as it gets created. However it does not trickle down to the word document. The document still opens as "Document2". Don't know what to do about it. Any ideas ? Ideally would like the word document to be saved on c:/ as "adi.doc"


Attachments

export_batch.dxl

Re: Automating my MS Word Export...
Mathias Mamsch - Thu Jan 02 20:38:41 EST 2014

dalvia - Thu Jan 02 13:08:35 EST 2014

I have made some progress since. I can see the outpuit filename I want in dialog box after it is created. However the actual word file does not get saved. My export_batch.dxl script has been attached. Also had to make 1 line change in word.dxl so that the DBE for data export file name is allocated

Changed this line ( line 3341 )

makeExporterUI(wordTitle, helpExportWord, false, false, null, null)

to ( mde 3rd argument true )

makeExporterUI(wordTitle, helpExportWord, true, false, null, null)

Now the dialog boz gets created. I can see the file name that I set ( "c:/adi.doc") on the dialog box as it gets created. However it does not trickle down to the word document. The document still opens as "Document2". Don't know what to do about it. Any ideas ? Ideally would like the word document to be saved on c:/ as "adi.doc"

I just realized that you are doing Word exports ... The Word Exporter of DOORS does not save the document after export. It just exports your document to your current Word instance and then just quits. So you need to save the document yourself. For this you can use the trick mentioned above to get a grab to the Word Application handles. Use the hooks into oleCreateAutoObject and oleGetAutoObject to get a grip to the OleAutoObj handle of Word.Application then you can use the ActiveDocument or something to get a handle to the exported document and save it. Regards, Mathias

Re: Automating my MS Word Export...
Ursy - Wed Apr 20 01:24:54 EDT 2016

Hello guys, 

 

I am new on this forum, so first of all I want to salute you all. I need your help to make my life easier,  I am trying to make an automation, using a batch file in order to obtain a proper excel export from DOORS. I followed all the instructions from here:

http://www-01.ibm.com/support/docview.wss?uid=swg21567793

The thing is that I am getting errors in DXL, which from my point of view belongs to the path of the module. I entered in the export.bat the following: 

 
@echo off

 

export.bat "/MLB Evo_FAS_IS_EF/MLBevo1/xxx/xxx/TLM - xxx"

After execution I get the following error:

 -R-W- DXL: <Line:1> null value passed to DXL command (current Module)
Backtrace:
    <wizard/welcome/welcomewiz.dxl:703> 
    <Line:1> 
You need to have a current Module set for the export.

 

Help!

 

  •  
  •  

Re: Automating my MS Word Export...
morast - Wed Apr 20 02:57:40 EDT 2016

Ursy - Wed Apr 20 01:24:54 EDT 2016

Hello guys, 

 

I am new on this forum, so first of all I want to salute you all. I need your help to make my life easier,  I am trying to make an automation, using a batch file in order to obtain a proper excel export from DOORS. I followed all the instructions from here:

http://www-01.ibm.com/support/docview.wss?uid=swg21567793

The thing is that I am getting errors in DXL, which from my point of view belongs to the path of the module. I entered in the export.bat the following: 

 
@echo off

 

export.bat "/MLB Evo_FAS_IS_EF/MLBevo1/xxx/xxx/TLM - xxx"

After execution I get the following error:

 -R-W- DXL: <Line:1> null value passed to DXL command (current Module)
Backtrace:
    <wizard/welcome/welcomewiz.dxl:703> 
    <Line:1> 
You need to have a current Module set for the export.

 

Help!

 

  •  
  •  

Yes your conclusion seems probable. I suggest you open yoru module and run the following DXL line to see if you have got the correct path:

print fullName(current)

The full module path in DOORS is from the closest parent project. Maybe that's your problem. 

Re: Automating my MS Word Export...
Mathias Mamsch - Wed Apr 20 06:36:59 EDT 2016

Ursy - Wed Apr 20 01:24:54 EDT 2016

Hello guys, 

 

I am new on this forum, so first of all I want to salute you all. I need your help to make my life easier,  I am trying to make an automation, using a batch file in order to obtain a proper excel export from DOORS. I followed all the instructions from here:

http://www-01.ibm.com/support/docview.wss?uid=swg21567793

The thing is that I am getting errors in DXL, which from my point of view belongs to the path of the module. I entered in the export.bat the following: 

 
@echo off

 

export.bat "/MLB Evo_FAS_IS_EF/MLBevo1/xxx/xxx/TLM - xxx"

After execution I get the following error:

 -R-W- DXL: <Line:1> null value passed to DXL command (current Module)
Backtrace:
    <wizard/welcome/welcomewiz.dxl:703> 
    <Line:1> 
You need to have a current Module set for the export.

 

Help!

 

  •  
  •  

Note that you are getting two things: 

  • A warning that you are executing  current = null (because the read('..', true) statement does not find the module
  • A message from the export script, that the current module is not set. 

One reason for this can be, that you simply have a typo on your module name, or the user that runs the script has no access to the module. The other possibility is that you might have unsupported characters inside the module name. Note that the export.bat script creates the following command line parameter: 

-D "current = read(\"%~1\", true); #include <export_batch.dxl>"

where %~1 means the first command line parameter. To find out whats going on, you can change this part of the batch file to: 

-D "string sMod=\"%~1\"; print sMod; current = read(sMod, true); #include <export_batch.dxl>"

Normally DOORS will not allow you special ascii characters. But its possible if you got certain non-ascii characters inside the module name, that the command line will not correctly transfer them. 

So

1. double check the module as you pass it over the command line exists and the user can access it.

2. do the above change and post the full module name to test if there are any non ascii characters on it, that might be transferred badly over the commandline. 

Regards, Mathias

 

 

Re: Automating my MS Word Export...
Ursy - Thu Apr 21 02:15:45 EDT 2016

Mathias Mamsch - Wed Apr 20 06:36:59 EDT 2016

Note that you are getting two things: 

  • A warning that you are executing  current = null (because the read('..', true) statement does not find the module
  • A message from the export script, that the current module is not set. 

One reason for this can be, that you simply have a typo on your module name, or the user that runs the script has no access to the module. The other possibility is that you might have unsupported characters inside the module name. Note that the export.bat script creates the following command line parameter: 

-D "current = read(\"%~1\", true); #include <export_batch.dxl>"

where %~1 means the first command line parameter. To find out whats going on, you can change this part of the batch file to: 

-D "string sMod=\"%~1\"; print sMod; current = read(sMod, true); #include <export_batch.dxl>"

Normally DOORS will not allow you special ascii characters. But its possible if you got certain non-ascii characters inside the module name, that the command line will not correctly transfer them. 

So

1. double check the module as you pass it over the command line exists and the user can access it.

2. do the above change and post the full module name to test if there are any non ascii characters on it, that might be transferred badly over the commandline. 

Regards, Mathias

 

 

Thank you guys for your responses!

After morast wrote me, I discovered that I do not have rights to run DXLs, because the RUN and Save as buttons appear to be inactive (http://www-01.ibm.com/support/docview.wss?uid=swg21404574). I will request permission for this, and after getting it, I will try again.

Thanks again!