CnPack Forum » CnWizards IDE Wizards » Script? Getting fully qualified file names of all files of an project

2011-3-25 06:23 cnpackfan
Script? Getting fully qualified file names of all files of an project

Hello again,

I'm looking for a way to get the fully qualified file names of all files of an project, mainly the source and header files. As a short term solution I'm looking for a script which copies the names to the clipboard. I can write it for the community, but need some suppport for starting. Another approach would be using the Source Statistics Wizard and add that functionality.

:victory:@ Passion and all the others: Thanks for that great tool!:)

Many thanks and greetings

2011-3-27 20:01 Passion
There's a Demo named OTADemo1.pas in PSDemo directory. It provides a way how to list all files of a project or projectgroup, or just opened files. But now it seems only works fine under Delphi 7 or above.

In BDS, maybe the Pascal Scrpit Engine has a bug that we can't get project modules. We're doing some research to avoid this problem.:L

2011-4-1 20:40 Passion
We add some aux funtions in nightly build. If this version installed, below script can be used to walk all module files from the project group.

{                                                       }
{       Pascal Script Source File                       }
{       Run by RemObjects Pascal Script in CnWizards    }
{                                                       }
{       Generated by CnPack IDE Wizards                 }
{                                                       }

program WalkingAllFiles;

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

  PG: IOTAProjectGroup;
  P: IOTAProject;
  I, J, C1, C2: Integer;
  PG := CnOtaGetProjectGroup;
  if PG = nil then
    Writeln('NO ProjectGroup. Exit.');
  C1 := CnOtaGetProjectCountFromGroup();
  Writeln('ProjectGroup got. Count ' + IntToStr(C1));

  for I  := 0 to C1 - 1 do
    P := CnOtaGetProjectFromGroupByIndex(I);
    if P <> nil then
      Writeln('Project ' + IntToStr(I) + '. Project File Name ' + P.GetFileName);
      C2 := CnOtaGetModuleCountFromProject(P);
      Writeln('Project ' + IntToStr(I) + '. Project Module Count ' + IntToStr(C2));
      for J := 0 to C2 - 1 do
        Writeln('Project ' + IntToStr(I) + ' . File ' + IntToStr(J) +
          '. File Name ' + CnOtaGetModuleFromProjectByIndex(P, J).GetFileName);

2011-4-5 21:54 cnpackfan
Hello again Passion,

many thanks for that script. Will try it.


页: [1]

Powered by Discuz! Archiver 5.0.0  © 2001-2006 Comsenz Inc.