public class Script
{
///
///
///
/// Name of the directory (containing .el? files) in which all projects will be exported to PDF
[DeclareAction("ProjectsInFolderToPdfAction")]
public void ProjectsInFolderToPdf(String PROJECTFOLDERPATH)
{
Progress progress = new Progress("SimpleProgress");
progress.BeginPart(100, "");
progress.SetAllowCancel(true);
progress.ShowImmediately();
//resolve path variables
PROJECTFOLDERPATH = PathMap.SubstitutePath(PROJECTFOLDERPATH);
//get all projects in the directory
System.IO.DirectoryInfo oDi = new System.IO.DirectoryInfo(PROJECTFOLDERPATH);
System.IO.FileInfo[] oFiles = oDi.GetFiles("*.el?");
int iFiles = oFiles.Length;
foreach (System.IO.FileInfo oElkFile in oFiles)
{
if (!progress.Canceled())
{
progress.BeginPart(100 / iFiles, "PDF Export");
ActionCallingContext pdfContext = new ActionCallingContext();
pdfContext.AddParameter("LogMsgActionDone", "true");
pdfContext.AddParameter("PROJECTNAME", oElkFile.FullName);
pdfContext.AddParameter("TYPE", "PDFPROJECTSCHEME");
if (!System.IO.Directory.Exists(oElkFile.FullName.Replace(oElkFile.Extension, ".edb") + "\\DOC"))
{
System.IO.Directory.CreateDirectory(oElkFile.FullName.Replace(oElkFile.Extension, ".edb") + "\\DOC");
}
pdfContext.AddParameter("EXPORTFILE", oElkFile.FullName.Replace(oElkFile.Extension, ".edb") + "\\DOC\\" + oElkFile.Name.Replace(oElkFile.Extension, ".pdf"));
new CommandLineInterpreter().Execute("export", pdfContext);
progress.EndPart();
}
}
progress.EndPart(true);
}
}