'MegaContext(Fields,Types) 'Uses(Components) Dim oRoot as MegaRoot Set oRoot = GetRoot Dim oProgControl as MegaProgressControl Dim oFSO Set oFSO = CreateObject("Scripting.FileSystemObject") Dim oFile, fpath Dim oMacro Set oMacro = oRoot.CurrentEnvironment.GetMacro("~JD38EYtsKz5R[BPMN2ImportMethod]") Dim sDirectoryPath sDirectoryPath = "c:\Import" Dim sResPath sResPath = sDirectoryPath & "\Results\results_" Dim i i=1 On Error Resume Next For Each oFile in oFSO.GetFolder(sDirectoryPath).Files Dim sResFilePath sResFilePath = sResPath & i & ".txt" fpath = oFile.Path ' Print fpath dim oWindow set oWindow = oRoot.ContextObject("#Window") oRoot.CallMethod "~lF381XtsKX4R[BPMN2Import]","OP",fpath,false,sResFilePath,oWindow if Err.Number <> 0 Then Print Err.Number & " --> " & Err.Description Err.Clear end if i=i+1 if Not oWindow is Nothing then oWindow.Abort oWindow.Destroy end if Print "Done!" Next Set oFSO = Nothing