home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / ad109u28.zip / menucvt.cmd < prev    next >
OS/2 REXX Batch file  |  1996-08-13  |  6KB  |  114 lines

  1. /* Adept v0.01 - 1.07 to Adept 1.08a5+ Menu Converter */
  2.  
  3. say 'Menu Converion Program for AdeptXBBS v1.08a v0.5.0'
  4. say ''
  5. say 'Run this program from in your Menus sub-directory'
  6.  
  7. Call CharOut, 'Enter in the Drive Letter Adept is installed on. [ie D:] : '
  8. Pull Drive
  9. If Pos(':',Drive) = 0 Then Drive = Drive || ':'
  10.  
  11. OldDirectory = Directory()
  12.  
  13. rc = Directory(Drive || '\Adept\Menus')
  14.  
  15. call RxFuncAdd 'SysLoadFuncs', 'rexxutil', 'SysLoadFuncs'
  16. call 'SysLoadFuncs'
  17.  
  18. '@echo off'
  19.  
  20. RC = SysFileTree('*.menu', 'fline', 'FO')
  21.  
  22. do i = 1 to fline.0
  23.  
  24.    Pos = LASTPOS('\', fline.i)
  25.    Len = LENGTH(fline.i)
  26.    FileName = RIGHT(fline.i, (Len - Pos))
  27.  
  28.    NewName = FileName||'.New'
  29.    OldName = FileName
  30.    NewOld  = FileName||'.old'
  31.  
  32.    File = FileName
  33.  
  34.    Say File
  35.  
  36.    MenuLine = Strip(LineIn(File,1,1))
  37.  
  38.    do
  39.       x = 0
  40.  
  41.       if(MenuLine == 'BEGINMENU') then do
  42.          say File || ' Already Converted!'
  43.       end
  44.       else do
  45.          if(MenuLine \= '') then
  46.          RC = LineOut(NewName, 'BEGINMENU')
  47.  
  48.          if(MenuLine \= '') then do
  49.  
  50.             PARSE VALUE MenuLine WITH PromptText ',' Color ',' MenuFilename ',' MenuLocation ',' Flags
  51.  
  52.             if(PromptText \= '') then RC = LineOut(NewName, '    PROMPT           ' || PromptText)
  53.             if(Color \= '') then Rc = LineOut(NewName, '    PROMPTCOLOR      ' || Color)
  54.             if(MenuFileName \= '') then RC = LineOut(NewName, '    DISPLAYFILE      ' || MenuFileName)
  55.             if(MenuLocation \= '') then RC =  LineOut(NewName, '    MENULOCATION     ' || MenuLocation)
  56.             if(Flags \= '') then RC = LineOut(NewName, '    MENUFLAGS        ' || Flags)
  57.  
  58.             do while (Lines(File) == 1)
  59.                MenuLine = Strip(LineIn(File))
  60.  
  61.                if(MenuLine == ';' | Left(MenuLine,1) == ';') then do
  62.                   RC = LineOut(NewName, '  MENUCOMMENT            ' || MenuLine)
  63.                   Iterate
  64.                end
  65.  
  66.                if(MenuLine == '') then do
  67.                   Iterate
  68.                end
  69.  
  70.                PARSE VALUE MenuLine WITH Key ',' Command ',' OutputString ',' DataString ',' Color ',' MinAge ',' MaxAge ',' Sec1 ',' Sec2 ',' Flags1 ',' Flags2 ',' StartTime ',' EndTime ',' Gender ',' MinCredit ',' MaxCredit ',' MinTime ',' MaxTime ',' MinCall ',' MaxCall ',' MinPosts ',' MaxPosts ',' MinUpl ',' MaxUpl ',' MinDl ',' MaxDl ',' Group ',' PortFlags
  71.                RC = LineOut(NewName, '    BEGINMENUITEM')
  72.                   if(Key \= '') then          RC = LineOut(NewName, '        KEY              ' || Key)
  73.                   if(Command \= '') then      RC = LineOut(NewName, '        MENUCOMMAND      ' || Command)
  74.                   if(OutputString \= '') then RC = LineOut(NewName, '        DISPLAYSTRING    ' || OutputString)
  75.                   if(Color \= '') then        RC = LineOut(NewName, '        DISPLAYCOLOR     ' || Color)
  76.                   if(DataString \= '') then   RC = LineOut(NewName, '        DATAOPTION       ' || DataString)
  77.                   if(MinAge \= '') then       RC = LineOut(NewName, '        MINAGE           ' || MinAge)
  78.                   if(MaxAge \= '') then       RC = LineOut(NewName, '        MAXAGE           ' || MaxAge)
  79.                   if(Sec1 \= '') then         RC = LineOut(NewName, '        MINSEC1          ' || Sec1)
  80.                   if(Sec2 \= '') then         RC = LineOut(NewName, '        MINSEC2          ' || Sec2)
  81.                   if(Flags1 \= '') then       RC = LineOut(NewName, '        FLAGS1           ' || Flags1)
  82.                   if(FLags2 \= '') then       RC = LineOut(NewName, '        FLAGS2           ' || FLags2)
  83.                   if(Gender \= '') then       RC = LineOut(NewName, '        GENDER           ' || Gender)
  84.                   if(StartTime \= '') then    RC = LineOut(NewName, '        STARTTIME        ' || StartTime)
  85.                   if(EndTime \= '') then      RC = LineOut(NewName, '        ENDTIME          ' || EndTime)
  86.                   if(MinTime \= '') then      RC = LineOut(NewName, '        MINONLINETIME    ' || MinTime)
  87.                   if(MaxTime \= '') then      RC = LineOut(NewName, '        MAXONLINETIME    ' || MaxTime)
  88.                   if(MinCall \= '') then      RC = LineOut(NewName, '        MINCALLS         ' || MinCall)
  89.                   if(MaxCall \= '') then      RC = LineOut(NewName, '        MAXCALLS         ' || MaxCall)
  90.                   if(MinPosts \= '') then     RC = LineOut(NewName, '        MINPOSTS         ' || MinPosts)
  91.                   if(MaxPosts \= '') then     RC = LineOut(NewName, '        MAXPOSTS         ' || MaxPosts)
  92.                   if(MinUpl \= '') then       RC = LineOut(NewName, '        MINUPLOADS       ' || MinUpl)
  93.                   if(MaxUpl \= '') then       RC = LineOut(NewName, '        MAXUPLOADS       ' || MaxUpl)
  94.                   if(MinDl \= '') then        RC = LineOut(NewName, '        MINDOWNLOADS     ' || MinDl)
  95.                   if(MaxDl \= '') then        RC = LineOut(NewName, '        MAXDOWNLOADS     ' || MaxDl)
  96.                   if(Group \= '') then        RC = LineOut(NewName, '        GROUP            ' || Group)
  97.                   if(PortFlags \= '') then    RC = LineOut(NewName, '        PORTFLAGS        ' || PortFlags)
  98.                RC = LineOut(NewName, '    ENDMENUITEM')
  99.             end
  100.             RC = LineOut(NewName, 'ENDMENU')
  101.             RC = LineOut(NewName)
  102.             RC = LineOut(File)
  103.             AdCmd = 'Ren ' || OldName || ' ' || NewOld
  104.             AdCmd
  105.             AdCmd = 'Ren ' || NewName || ' ' || OldName
  106.             AdCmd
  107.             say File || ' Converted'
  108.          end
  109.       end
  110.    end
  111. end
  112. Call Directory(OldDirectory)
  113. Say 'All Menus converted, Done..'
  114.