INF2obj, v 1.0

Автор: Gleb Yaltchick

Скачать скрипт.

/*  */

SAY
SAY "INF2obj, v 1.0, (C) Gleb Yaltchick"
SAY "   -h for help"
SAY

call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

if ARG() > 0 THEN INFname = ARG(1)
             ELSE INFname = '*.INF';

if COMPARE(INFname,'-h') = 0 then call ShowHelp

rc = SysFileTree(INFname,INFs,'FO');

IF INFs.0 > 0 THEN
  DO
    SAY INFs.0 || " files found"
    SAY "Creating folder..."
    rc = SysCreateObject("WPFolder","Help Folder","
","OBJECTID=","U");
    rc = SysOpenObject("
","Icon",1);
  END
ELSE
  DO
    SAY
    SAY "Noting to do... Sorry..."
    SAY
  END;

DO n=1 TO INFs.0
  INFdesc = ReadDesc(INFs.n);
  SAY INFs.n || " - " || INFdesc
  rc = CreateObject(INFs.n,INFdesc);
END

exit 0;

ReadDesc: PROCEDURE EXPOSE file desc;
 
  file = ARG(1);
  desc = CHARIN(file,X2D('6C'),X2D('20'));
  i = POS(X2C('0'),desc);
  IF \ (i = 0) THEN desc = LEFT(desc,i-1);
  return desc;

CreateObject: PROCEDURE EXPOSE file desc;

  file = ARG(1);
  desc = ARG(2);

  class = 'WPProgram';
  title = desc;
  location = '
';

  setup = 'EXENAME=view.exe;';
  setup = setup || 'CONCURENTVIEW=NO;';
  setup = setup || 'PARAMETERS=' || file || ';';
 
  rc = SysCreateObject(class,title,location,setup,'fail');
  return rc;

ShowHelp:
  SAY "USAGE:"
  SAY "  INF2obj [File or FileMask]"
  SAY
  SAY "INF2obj -h               Show this help"
  SAY "INF2obj                  Search all *.INF files (default)"
  SAY "INF2obj LAN4*.INF"
  SAY
  EXIT 1;