do( var([strFile], vbString), var([strDir], vbString), var([atmLayer], vbAtom), var([strLine], vbString), var([valCol], vbValue), var([valRep], vbValue), var([valRow], vbValue), var([ExcelOLETemp], vbOle), var([valExcelRow], vbValue), {**Loop over all scenerios enabled in the experiment wizard**} Repeat( nRows(atm_EW), if( CellAsValue(Count, 8, atm_EW), do( {**Loop over replications**} valRow := Count, Repeat( CellAsValue(valRow, 4, atm_EW) - CellAsValue(valRow, 9, atm_EW) + 1, do( valRep := CellAsValue(valRow, 9, atm_EW) + Count - 1, {** Load Output**} PD_OUTPUT_RESET, PD_OUTPUT_FREELIBRARY, PD_OUTPUT_LOADLIBRARY, strDir := Concat(CellAsString(valRow, 2, atm_EW), CellAsString(valRow, 1, atm_EW), [\Rep], string(valRep)), PD_Output_LoadFromDirectory(strDir), strFile := Concat(strDir, [\FlowCounters.xlsx]), DeleteFile(strFile), ExcelOLETemp := CreateOLE([Excel.Application]), {Ole(ExcelOLETemp, [Visible], 1),} Ole(ExcelOLETemp, [Workbooks.Add]), Ole(ExcelOLETemp, [ActiveSheet.Name], [FlowCounters]), valExcelRow := 0, ForAtomLayerUnder( atmPDOutput, do( atmLayer := a, if( M(atmLayer) = atmMotherOutputLayer, {**Loop over all flow counters in the layer**} List_ForAllItemsInList( OutputLayer_GetlstFlowCounters(atmLayer), do( {**Get the output**} FlowCounter_ShowGraph(s, 2), {**Write name of layer flow counter**} inc(valExcelRow), Ole(ExcelOLETemp, Concat([ActiveSheet.Cells(], string(valExcelRow), [,], String(Count), [).Value]), Name(Rank(OutputLayer_GetLayerID(atmLayer), PDEnvAtom)), 2), Ole(ExcelOLETemp, Concat([ActiveSheet.Cells(], string(valExcelRow), [,], String(Count + 1), [).Value]), Name(s), 2), Repeat( nCols(s), do( valCol := Count, case( Count, strLine := [Time (s)], strLine := [Left to Right], strLine := [Right to Left] ), inc(valExcelRow), Ole(ExcelOLETemp, Concat([ActiveSheet.Cells(], string(valExcelRow), [,1).Value]), strLine, 2), Repeat( nRows(s), Ole(ExcelOLETemp, Concat([ActiveSheet.Cells(], string(valExcelRow), [,], String(Count + 1), [).Value]), CellAsValue(Count, valCol, s), 1) ) ) ), inc(valExcelRow) ) ) ) ) ), Ole(ExcelOLETemp, Concat([ActiveWorkbook.SaveAs(], sbo, StringReplace(strFile, [\], [\\], SR_REPLACE_ALL), sbc, [)])), Ole(ExcelOLETemp, [Workbooks.Close]), ExcelOLETemp := 0 ) ) ) ) ) )