I hope that someone can help me with this one:
(I've previously searched if other questions could fit...)
I'm trying to list all DOORS modules in a specific directory with a recursive DXL function and write the module names (full path/name) to an excel sheet
This is what i got until now...the problem seems to be that "z" is reset to 1 again
In Excel VBA i call the DXL script like this (works):
objDoorsApp.runStr ("#include <" & sInterface & ">;;createFolderNameForRecursion ()")
It calls a function to initially call the recursive function: (works too)
void createFolderNameForRecursion()
{
int z = 1
WriteAllModulesRecursively2ExistExcel(folder("/00_Platform/30Software/30_Basis_SW/IoStck"), z);
}
Here's the recursive function:
void WriteAllModulesRecursively2ExistExcel(Folder f, int z)
{
Item i
Module m
string ausgabe,temp
OleAutoObj objExcel = oleGetAutoObject("Excel.Application")
OleAutoObj objBook
OleAutoObj objSheet = null
OleAutoArgs oleArgs = create
Object oCur
Module mCur
bool excelVisible
string sTemp = ""
string sResult = ""
//int iRow = 1
string sBookName = "PP_Tst_IT_Report_Template.xls"
string sSheetName = "Delivery"
string result = ""
/* Make Excel visible to the user */
oleGet(objExcel, "Visible", excelVisible)
if (!excelVisible) olePut(objExcel,"visible",true)
/* Get workbook */
sResult = oleGet(objExcel,"Workbooks", sBookName)
/* Get a handle on Sheet 1 in active workbook */
clear oleArgs
put(oleArgs, sSheetName)
sResult = oleGet(objExcel, "Sheets", oleArgs, objSheet)
for i in f do
{
if (type(i)=="Folder" || type(i) =="Project") { WriteAllModulesRecursively2ExistExcel(folder(i), z) }
if (type(i)=="Formal")
{
sTemp = fullName i
if (sTemp!=null)
{
result = z " --> " fullName i "\n"
objCell = ExcelGetCell(objSheet, z, 1)
olePut(objCell,"Value",result)
z++
}
}
}
oleCloseAutoObject (objExcel)
}
Like i said "z" is reset to 1 if the "end" of a folder is reached.
What can I do about it? Is there any way?
If i just say
print fullName i "\n"
it works...but i need the module names in an excel sheet